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

    Writes structured records through a shared Handler.

    Logger instances are lightweight. Use child for a component below the current name, withFields for fields shared by later records, and detached for an independent full name.

    Do not add bearer tokens, private keys, or other secrets as fields. Text handlers inspect ordinary objects, and JSON handlers only redact values that define a safe customJson method.

    import { resolveLogger } from '@nebius/js-sdk/runtime/util/logging';

    const logger = resolveLogger('INFO', 'example.application');
    const requestLogger = logger.child('request', { requestId: 'req-1' });
    const error = new Error('connection closed');
    requestLogger.info('Sending request', { attempt: 1 });
    requestLogger.error('Request failed', { error }, true);

    Indexable

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

      Writes structured records through a shared Handler.

      Logger instances are lightweight. Use child for a component below the current name, withFields for fields shared by later records, and detached for an independent full name.

      Do not add bearer tokens, private keys, or other secrets as fields. Text handlers inspect ordinary objects, and JSON handlers only redact values that define a safe customJson method.

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

            Returns string

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

            Returns object

    Index
    traceByDefault: boolean = false

    Adds a call-site trace to this logger's named-level methods by default.

    child, sibling, and detached do not inherit this value.

    • Returns a logger whose name is this name plus . and the suffix.

      The child inherits this logger's fields. Its traceByDefault value is independent and defaults to false.

      Parameters

      • suffix: string
      • additionalArguments: Argument = {}
      • traceByDefault: boolean = false

      Returns Logger

    • Writes a debug record. Set withTrace to add a call-site trace.

      Parameters

      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Returns a logger with an independent full name.

      The new logger uses the same handler but does not inherit this logger's fields. It keeps additionalArguments by reference. Later changes to that object change fields written by the detached logger.

      Parameters

      • name: string
      • additionalArguments: Argument = {}
      • traceByDefault: boolean = false

      Returns Logger

    • Writes an error record. Set withTrace to add a call-site trace.

      Parameters

      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Writes an informational record. Set withTrace to add a call-site trace.

      Parameters

      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Writes a record at an explicit level.

      If withTrace is absent, this method does not add a call-site trace. It does not use traceByDefault. The named-level methods use that default when withTrace is absent.

      Parameters

      • level: Level
      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Returns a logger beside this logger in the name hierarchy.

      The sibling keeps this logger's fields. If this logger has no parent, the supplied name becomes the complete logger name.

      Parameters

      • siblingName: string
      • additionalArguments: Argument = {}
      • traceByDefault: boolean = false

      Returns Logger

    • Writes a trace-level record. Set withTrace to add a call-site trace.

      Parameters

      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Writes a warning record. Set withTrace to add a call-site trace.

      Parameters

      • message: string
      • Optionalargs: Argument
      • OptionalwithTrace: boolean

      Returns void

    • Returns a logger with additional fields and the same name.

      New fields replace existing fields with the same keys. The method copies only top-level fields. Later top-level changes to the input object do not change the returned logger, but nested objects and arrays stay shared. The returned logger inherits this logger's traceByDefault value unless the traceByDefault argument supplies another value.

      Parameters

      • fields: Argument
      • OptionaltraceByDefault: boolean

      Returns Logger