@nebius/js-sdk - v0.2.54
    Preparing search index...

    Class ConsoleHandler

    Writes configurable plain-text log records.

    This handler is suitable for non-interactive output. It supports a custom formatter or a template with name, level, time, message, args, and trace placeholders.

    import {
    ConsoleHandler,
    Level,
    Logger,
    } from '@nebius/js-sdk/runtime/util/logging';

    const handler = new ConsoleHandler({
    level: Level.DEBUG,
    format: '{time} [{level}] {name}: {message}{ args}',
    });
    const logger = new Logger(handler, 'example.worker');
    logger.debug('Started', { jobId: 'job-1' });

    Implements

    Indexable

    • [key: symbol]: (() => string) | (() => object)

      Writes configurable plain-text log records.

      This handler is suitable for non-interactive output. It supports a custom formatter or a template with name, level, time, message, args, and trace placeholders.

      • () => string
          • (): string
          • Returns a concise representation for text inspection.

            Returns string

      • () => object
          • (): object
          • Returns a JSON-safe value for logs.

            Returns object

    Index
    • Creates a plain-text handler.

      The default level is Level.INFO, the default filter matches every name, and the default output is the process console.

      Parameters

      • Optionalopts: {
            alwaysAddTrace?: boolean;
            argDelimiter?: string;
            argFormat?: ArgFormatFunction;
            filters?: Filters;
            format?: string | FormatFunction;
            level?: Level;
            output?: Output;
        }
        • OptionalalwaysAddTrace?: boolean

          Contains the always add trace.

        • OptionalargDelimiter?: string

          Contains the arg delimiter.

        • OptionalargFormat?: ArgFormatFunction

          Contains the arg format.

        • Optionalfilters?: Filters

          Contains the filters.

        • Optionalformat?: string | FormatFunction

          Contains the format.

        • Optionallevel?: Level

          Contains the level.

        • Optionaloutput?: Output

          Contains the output.

      Returns ConsoleHandler