@samatawy/rules
    Preparing search index...

    Interface ILogger

    A common interface for logging classes that can write logs to any destination. Implement this interface to create a bridge to your preferred logging library: Pino, Windston, Sentry, etc.

    interface ILogger {
        trace(msg: string, ...args: unknown[]): void;
        debug(msg: string, ...args: unknown[]): void;
        info(msg: string, ...args: unknown[]): void;
        warn(msg: string, ...args: unknown[]): void;
        error(msg: string, ...args: unknown[]): void;
        fatal(msg: string, ...args: unknown[]): void;
        log(level: LogLevel, msg: string, ...args: unknown[]): void;
        setLogLevel(level: LogLevel): void;
        canLog(level: LogLevel): boolean;
        flush(): void;
    }

    Implemented by

    Index

    Methods

    • Set the minimum log level for this logger. Messages with a lower log level will be ignored.

      Parameters

      • level: LogLevel

        the minimum log level to set.

      Returns void

    • Check if a message at the given log level would be logged by the current logger configuration.

      Parameters

      Returns boolean

    • In case your logger buffers logs, flush should be called at the end of execution to ensure all logs are written out. If your logger does not buffer logs, you can leave this method empty.

      Returns void