log

fun log(level: Level, span: TracingEvent.Span?, tags: Tags, message: String, arguments: Array<out Any?>, throwable: Throwable?)(source)

Logs a message with the specified logging level and additional context.

Parameters

level

The logging level of the event.

span

An optional span that can be used for tracing the context.

tags

Structured key-value dimensions attached to the event, kept separate from the message text (mirroring the tags carried by tracing spans and metering events).

message

The log message to be recorded.

arguments

Additional arguments to be included in the log event.

throwable

An optional throwable associated with the log event.


fun log(level: Level, span: TracingEvent.Span?, tags: Tags, message: String, arguments: Array<out Any?>, throwable: Throwable?, callSite: SourceLocation?)(source)

Logs a message with the specified logging level, additional context, and the source location of the call.

This overload is the target the log4k-compiler-plugin rewrites logging calls to: the plugin appends a compile-time SourceLocation so the emitted event carries accurate file/line/function information on every platform, without any runtime stack-walking. It can also be called directly when the call site is known by other means.

Parameters

level

The logging level of the event.

span

An optional span that can be used for tracing the context.

tags

Structured key-value dimensions attached to the event, kept separate from the message text (mirroring the tags carried by tracing spans and metering events).

message

The log message to be recorded.

arguments

Additional arguments to be included in the log event.

throwable

An optional throwable associated with the log event.

callSite

The source location of the call, or null when unknown.