Options to configure default value for a Logger instance.

Hierarchy

  • LoggerOptions

Properties

config?: Partial<ValueObject<{
    environment: (() => "test" | "development" | "production");
    fullDevLogs: (() => boolean);
    healthEndpointPort: (() => number);
    isDev: (() => boolean);
    isProd: (() => boolean);
    logLevel: (() => "" | "FATAL" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE");
    logMaskKeywords: (() => string[]);
    logMaskMaxDepth: (() => number);
    secureLoggingMode: (() => MaskMode);
    serviceId: (() => string);
}>>

Basic config that is used for various logging aspects. Values of note:

  • logLevel - used to decide if log should be written or skipped altogether because it's level value is (numerically) higher than configured value. (e.g. if ERROR (1) is configured, DEBUG (4) logs are skipped)
  • isProd - if logLevel is not defined for some reason or defined incorrectly, this value is used to determine the value of logLevel above. if true - INFO, if false - DEBUG.
  • secureLoggingMode - if UNSAFE_DEBUG_UNSAFE is used - logs are written in debug mode, which in default implementation would write a log with both masked and unmasked values for debugging purposes.
  • logMaskKeywords - used for deciding which logs to mask and which not to mask.
  • isDev - skips writing component property to Log object.
  • serviceId - information property written directly to matching Log properties. Written only in non-dev mode and appear as component in the log.
context?: string

Value to be written directly into Log.context property. Useful to figure out location of origin of a log.

Default

'DEFAULT'
logFormatter?: LogFormatter

A custom function that is called before writing the log file to customize to log format

logMiddleware?: LogMiddleware[]

Middleware functions that are applied in the given order to change the log details object before writing the log.

maskMiddleware?: MaskMiddleware

Middleware function that is used to mask logs. If not specified - default masking middleware is used.

skipMaskMiddleware?: SkipMaskMiddleware

Middleware function that is used to skip logs masking. If not specified - logs will be masked based on maskMiddleware without custom skips. It is also possible to modify selected properties of a log using this middleware (properties include message, details and error).

Generated using TypeDoc