seyfert
    Preparing search index...

    Class Logger

    Represents a logger utility for logging messages with various log levels.

    Index

    Constructors

    • Constructs a new Logger instance with the provided options.

      Parameters

      • options: LoggerOptions

        The options for configuring the logger.

      Returns Logger

    Properties

    options: Required<LoggerOptions>

    The options for configuring the logger.

    colorFunctions: Map<LogLevels, (str: string) => string> = ...

    A map containing color functions for different log levels.

    DEFAULT_OPTIONS: Required<LoggerOptions> = ...

    The default options for the logger.

    dirname: string = 'seyfert-logs'
    prefixes: Map<LogLevels, string> = ...

    A map containing prefixes for different log levels.

    saveOnFile?: string[] | "all"

    Accessors

    Methods

    • Logs a debug message.

      Parameters

      • ...args: any[]

        The arguments to log.

      Returns void

    • Logs an error message.

      Parameters

      • ...args: any[]

        The arguments to log.

      Returns void

    • Logs a fatal error message.

      Parameters

      • ...args: any[]

        The arguments to log.

      Returns void

    • Logs an info message.

      Parameters

      • ...args: any[]

        The arguments to log.

      Returns void

    • Logs a message with the specified log level.

      Parameters

      • level: LogLevels

        The log level.

      • ...args: unknown[]

        The arguments to log.

      Returns void

      The logged message.

    • Logs a warning message.

      Parameters

      • ...args: any[]

        The arguments to log.

      Returns void

    • Allows customization of the logging behavior by providing a custom callback function.

      Parameters

      • cb: CustomizeLoggerCallback

        The custom callback function for logging.

      Returns void

      Logger.customize((logger, level, args) => {
      // Custom logging implementation
      });
    • Customizes the logging filename by providing a callback function. The callback receives the logger instance and should return the desired filename.

      Parameters

      • cb: AssignFilenameCallback

        A function that takes the logger instance and returns a string representing the customized filename for the log.

      Returns void

      Logger.customizeFilename((logger) => {
      return `${logger.name}-${Date.now()}.log`;
      });
    • A function that returns the input string as is, without any color modification.

      Parameters

      • msg: string

        The message to log.

      Returns string

      The input message as is.