BaseConstructorOptions: {
    customConfigService?: ConfigServiceInterface;
    environment?: Environment;
    jsonReplacerFn?: CustomJsonReplacerFn;
    logLevel?: LogLevel;
    sampleRateValue?: number;
    serviceName?: string;
}

Base constructor options for the Logger class.

Type declaration

  • OptionalcustomConfigService?: ConfigServiceInterface

    A custom config service that can be passed to the Logger constructor to extend the default behavior.

    See ConfigServiceInterface for more information.

  • Optionalenvironment?: Environment

    The environment in which the Lambda function is running.

  • OptionaljsonReplacerFn?: CustomJsonReplacerFn

    A custom JSON replacer function that can be passed to the Logger constructor to extend the default serialization behavior.

    By default, we already extend the default serialization behavior to handle BigInt and Error objects, as well as remove circular references. When a custom JSON replacer function is passed to the Logger constructor, it will be called before our custom rules for each key-value pair in the object being stringified.

    This allows you to customize the serialization while still benefiting from the default behavior.

  • OptionallogLevel?: LogLevel

    The level threshold for the logger to log at.

  • OptionalsampleRateValue?: number

    The percentage rate at which the log level is DEBUG.

    See Sampling debug logs for more information.

  • OptionalserviceName?: string

    Service name to be included in log items for easier correlation.