# Interface FileLogOptions

Specify and override default log file options

    const fileLogger = loggerRollingApp({
      file: {
          level: 'warn', // file will log `warn` and higher
          path: '/my/cool/path/output.log', // output to log file at this path
          frequency: 'daily', // rotate hourly
          size: '20MB', // rotate if file size grows larger than 20MB
          timestamp: 'unix' // use unix epoch timestamp instead of iso8601 in rolling file
      }
    });

interface FileLogOptions {
size?: string | number;
frequency?: number | "daily" | "hourly";
timestamp?: "unix" | "iso" | "auto";
path?: string | (() => string);
level?:
| false
| "silent"
| "fatal"
| "error"
| "warn"
| "info"
| "log"
| "verbose"
| "debug"
| "trace";
}

#### Hierarchy (view full)

- FileOptions
  - FileLogOptions
    - FileLogOptionsStrong

- Defined in src/types.ts:213

#####
Index

### Properties

size?
frequency?
timestamp?
path?
level?

##
Properties

### `Optional` size

size?: string | number

The maximum size of a given rolling log file.

Can be combined with frequency. Use k, m and g to express values in KB, MB or GB.

Numerical values will be considered as MB.

#### Default

    '10MB'

Inherited from FileOptions.size

- Defined in src/types.ts:146

### `Optional` frequency

frequency?: number | "daily" | "hourly"

The amount of time a given rolling log file is used. Can be combined with size.

Use `daily` or `hourly` to rotate file every day (or every hour). Existing file within the current day (or hour) will be re-used.

Numerical values will be considered as a number of milliseconds. Using a numerical value will always create a new file upon startup.

#### Default

    'daily'

Inherited from FileOptions.frequency

- Defined in src/types.ts:156

### `Optional` timestamp

timestamp?: "unix" | "iso" | "auto"

For rolling log files

When

- value passed to rolling destination is a string (`path` from LogOptions is a string) and
- `frequency` is defined

This determines the format of the datetime inserted into the log file name:

- `unix` - unix epoch timestamp in milliseconds
- `iso` - Full ISO8601 datetime IE '2024-03-07T20:11:34Z'
- `auto`
  - When frequency is `daily` only inserts date IE YYYY-MM-DD
  - Otherwise inserts full ISO8601 datetime

#### Default

    'auto'

Inherited from FileOptions.timestamp

- Defined in src/types.ts:177

### `Optional` path

path?: string | (() => string)

The path and filename to use for log files.

If using rolling files the filename will be appended with `.N` (a number) BEFORE the extension based on rolling status.

May also be specified using env LOG_PATH or a function that returns a string.

If path is relative the absolute path will be derived from `logBaseDir` (in `LoggerAppExtras`) which defaults to CWD

#### Default

    './logs/app.log'

#### See

LoggerAppExtras

Inherited from FileOptions.path

- Defined in src/types.ts:208

### `Optional` level

level?:
| false
| "silent"
| "fatal"
| "error"
| "warn"
| "info"
| "log"
| "verbose"
| "debug"
| "trace"

Specify the minimum log level to output to rotating files. If `false` no log files will be created.

- Defined in src/types.ts:217