Core - v1.3.2
    Preparing search index...

    Class LogFields

    Selects which ambient context fields reach a log line.

    Reads the comma-separated LOG_FIELDS declaration before the configured logging.fields fallback. A star admits everything; an empty declaration admits nothing. An unset declaration uses the configured fields, or all fields when no fallback is registered.

    This selection applies to context only. Payload fields passed to an individual log call are always retained.

    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.