Skip to content

LogRecord

LogRecord = object

Defined in: types.ts:52

A structured log record. Transports receive these and decide what to do.

Records are plain JSON-serializable objects with no methods. The shape is stable - transports can safely persist or transmit them.

optional args?: unknown[]

Defined in: types.ts:88

Extra printf-style arguments for message. The console transport substitutes %s/%d/%i/%f/%j/%o/%O/%%; JSON transports keep them alongside the template.


context: Record<string, unknown>

Defined in: types.ts:63

Structured context attached at the log call or via child().


optional error?: SerializedError

Defined in: types.ts:65

Optional error, if .error() was called with one.


optional kind?: string

Defined in: types.ts:75

Presentation tag a transport can map to a badge or colour without abusing level (e.g. "success" → green ✔). log-kit never interprets it.


level: LogLevel

Defined in: types.ts:59

Severity level.


message: string

Defined in: types.ts:61

Human-readable message (or a printf-style template when args is set).


optional meta?: Record<string, unknown>

Defined in: types.ts:82

Host-owned passthrough payload. log-kit never reads or mutates this — it is a first-class escape hatch for wrappers that need to carry their own entry shape (presentation data, original call, etc.) to a transport, keeping context for the user’s structured data.


optional scope?: string

Defined in: types.ts:70

Hierarchical scope, e.g. "app:manifest", set via child(name). A presentation transport can render it as a prefix.


timestamp: string | number

Defined in: types.ts:57

Timestamp at record creation. An ISO 8601 string by default; a number (epoch ms) or other shape when LoggerConfig.timestamp is set.