Default Mosaic logger class. Used to write logs to the console in JSON format (no line breaks).

Hierarchy

  • Logger

Constructors

  • Creates a Logger instance using provided options object. Default values are used if options are not provided.

    Parameters

    Returns Logger

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);
}>>
logFormatter?: LogFormatter
logMiddleware: LogMiddleware[]
loggerContext: string
maskMiddleware?: MaskMiddleware
maxLevel: LogLevel
skipMaskMiddleware?: SkipMaskMiddleware

Methods

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns undefined | {
        formattedLog: string | Log;
        level: LogLevel;
    }

  • Parameters

    Returns ((...data) => void)

      • (...data): void
      • Parameters

        • Rest ...data: any[]

        Returns void

  • Gets the middleware at the moment of the log generation, since the Logger instance can be created before the global log middleware setup.

    Returns LogFormatter

  • Gets the middleware at the moment of the log generation, since the Logger instance can be created before the global log middleware setup.

    Returns LogMiddleware[]

  • Gets the middleware at the moment of the log generation, since the Logger instance can be created before the global log middleware setup.

    Returns undefined | MaskMiddleware

  • Gets the middleware at the moment of the log generation, since the Logger instance can be created before the global log middleware setup.

    Returns undefined | SkipMaskMiddleware

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • error: Error

    Returns void

  • Parameters

    Returns void

  • Writes a log message. Log level and errors can optionally be set.

    Parameters

    • message: string | LogMessage

      The message that will be logged.

    • __namedParameters: {
          error?: Error;
          level?: LogLevel;
      } = {}
      • Optional error?: Error

        Can be used to pass an error object along with the log entry

      • Optional level?: LogLevel

        The severity level the message should have

    Returns void

Generated using TypeDoc