A Record holds information about a log event. Copies of a Record share state. Do not modify a Record after handing out a copy to it. Call [NewRecord] to create a new Record. Use [Record.Clone] to create a copy with no shared state.

Hierarchy

  • Record

Methods

  • Add converts the args to Attrs as described in [Logger.Log], then appends the Attrs to the [Record]'s list of Attrs. It omits empty groups.

    Parameters

    • Rest ...args: any[]

    Returns void

  • AddAttrs appends the given Attrs to the [Record]'s list of Attrs. It omits empty groups.

    Parameters

    • Rest ...attrs: Attr[]

    Returns void

  • Attrs calls f on each Attr in the [Record]. Iteration stops if f returns false.

    Parameters

    • f: ((_arg0) => boolean)
        • (_arg0): boolean
        • Parameters

          Returns boolean

    Returns void

  • Clone returns a copy of the record with no shared state. The original record and the clone can both be modified without interfering with each other.

    Returns slog.Record

  • NumAttrs returns the number of attributes in the [Record].

    Returns number

Properties

level: Level

The level of the event.

message: string

The log message.

pc: number

The program counter at the time the record was constructed, as determined by runtime.Callers. If zero, no program counter is available.

The only valid use for this value is as an argument to [runtime.CallersFrames]. In particular, it must not be passed to [runtime.FuncForPC].

time: Time

The time at which the output method (Log, Info, etc.) was called.

Generated using TypeDoc