Interface LogMessage

A structured log message emitted by RecordKit, delivered as the payload of the 'log' event.

Example

recordkit.on('log', (message) => {
if (message.level === 'error') myLogger.error(message.category, message.message, message.metadata)
})
interface LogMessage {
    timestamp: number;
    level: LogLevel;
    category: string;
    message: string;
    metadata: Record<string, string>;
    formattedMessage: string;
}

Properties

timestamp: number

Time the message was logged, in milliseconds since the Unix epoch. Use new Date(timestamp) to get a Date.

level: LogLevel

Severity level of the message.

category: string

Category the message belongs to (e.g. the subsystem that emitted it).

message: string

The log message text.

metadata: Record<string, string>

Additional structured key/value metadata attached to the message.

formattedMessage: string

Pre-formatted, human-readable representation of the message (timestamp, level, category, message and metadata).

Generated using TypeDoc