Core - v1.3.1
    Preparing search index...

    Class LogFields

    Which context fields reach the log line.

    A log line carries two kinds of field, and only one of them is negotiable. Context is ambient — the request id, the method, the path, the address — repeated on every line for the span of a request, and stamped by middleware rather than chosen at the call site. Payload is what a caller passed to one log call because that call needed it. This governs the first and never the second: a field someone typed out deliberately is not noise to be filtered.

    The declaration is a comma-separated list, read from LOG_FIELDS in the environment first and the configuration surface second — the same order as LOG_LEVEL, and for the same reason. A deployment can narrow what it ingests without a rebuild.

    * admits everything and is the kernel default. An empty declaration admits nothing, which is not the same as leaving it unset: LOG_FIELDS="" is a deployment saying the level, the event, and the message are the whole line.

    const fields = LogFields.fromEnv({ LOG_FIELDS: 'requestId,method,path' })
    fields.permits('requestId') // true
    fields.permits('colo') // false

    Bayu Dwiyan Satria

    1.2.1

    1.2.1

    Index
    allowed: Set<string>

    The admitted names, or null when every field is admitted.

    • Reads the declaration for the current environment.

      Parameters

      • env: { LOG_FIELDS?: string }

        Anything carrying an optional LOG_FIELDS. Tolerates null.

      Returns LogFields

      The resolved allow-list.

      LOG_FIELDS is checked for being declared, not for being truthy, because an empty string is a meaningful declaration — it means "no context fields" — and would otherwise fall through to the surface and quietly emit more than the deployment asked for.

    • Reads a comma-separated declaration.

      Parameters

      • value: string

        The declaration, such as requestId,method,path.

      Returns LogFields

      The allow-list it describes.

    • Whether a context field reaches the line.

      Parameters

      • name: string

        The field name.

      Returns boolean

      True when the field is admitted.