StructuredLogger

class StructuredLogger(sinks: List<LoggingSink>, policyProvider: () -> ObservabilityPolicy, enabledProvider: () -> Boolean? = null) : Logger

Multi-sink structured logger implementation.

Dispatches log entries to configured sinks with automatic enrichment of correlation context and thread information.

Security (BSI SYS.3.2.2.A12): Centralized logging with configurable verbosity per sink.

Thread Safety: This class is thread-safe. All sink dispatching is synchronized and sinks must be thread-safe.

Since

0.4.0

Constructors

Link copied to clipboard
constructor(sinks: List<LoggingSink>, policyProvider: () -> ObservabilityPolicy, enabledProvider: () -> Boolean? = null)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun close()

Close all sinks.

Link copied to clipboard
open override fun d(tag: String, message: String, fields: Map<String, String> = emptyMap())

Log a debug message. Use for development-time debugging.

Link copied to clipboard
open override fun e(tag: String, message: String, throwable: Throwable? = null, fields: Map<String, String> = emptyMap())

Log an error message. Use for error conditions that should be investigated.

Link copied to clipboard
fun flush()

Flush all sinks.

Link copied to clipboard
open override fun i(tag: String, message: String, fields: Map<String, String> = emptyMap())

Log an info message. Use for general operational information.

Link copied to clipboard
open override fun isEnabled(level: LogLevel): Boolean

Check if logging is enabled at the given level. Use to avoid expensive string formatting when logging is disabled.

Link copied to clipboard
open override fun log(level: LogLevel, tag: String, message: String, throwable: Throwable? = null, fields: Map<String, String> = emptyMap())

Log a message at the specified level.

Link copied to clipboard
open override fun v(tag: String, message: String, fields: Map<String, String> = emptyMap())

Log a verbose message. Use for detailed debugging information.

Link copied to clipboard
open override fun w(tag: String, message: String, throwable: Throwable? = null, fields: Map<String, String> = emptyMap())

Log a warning message. Use for potentially problematic situations.