Core - v1.3.1
    Preparing search index...

    Interface LogContext

    Ambient fields attached to every line a logger emits.

    Ambient means constant for the span — the request being handled, the component doing the handling. Anything that varies from one line to the next is the logger's data argument instead, and the event name is neither: it is the first argument, and it names what happened.

    service is below but is not normally passed here: Logger.fromEnv stamps it from the environment on every line it creates. Passing it in overrides that for one logger, which a fan-in — a relay logging on behalf of the service it forwarded for — occasionally wants and nothing else does. Naming a class or a module is what component is for.

    Bayu Dwiyan Satria

    1.2.0

    1.0.0

    interface LogContext {
        component?: string;
        method?: string;
        path?: string;
        requestId?: string;
        service?: string;
        [key: string]: unknown;
    }

    Indexable

    • [key: string]: unknown

      Any other ambient field worth repeating on every line.

    Index
    component?: string

    Which part of the application emitted the line — a class, a module, a background task. The answer to "where in this service", where service answers "which service".

    method?: string

    HTTP method of the request being handled.

    path?: string

    Path of the request being handled.

    requestId?: string

    Correlates every line produced while handling one request.

    service?: string

    Which deployment emitted the line.

    Stamped by Logger.fromEnv from SERVICE_NAME. Set it here only to override that for one logger.