Logger class

The core logging utility for the Kronix framework.

It supports multiple output drivers, JSON logging, and contextual logging with Request-IDs.

Constructors

Logger([Map<String, dynamic>? _context])
Creates a new Logger with optional context.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

debug(String message, [Map<String, dynamic>? data]) → void
Logs a debug message.
error(String message, {Object? error, StackTrace? stackTrace, Map<String, dynamic>? data}) → void
Logs an error message with optional error and stackTrace.
info(String message, [Map<String, dynamic>? data]) → void
Logs an info message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
warning(String message, [Map<String, dynamic>? data]) → void
Logs a warning message.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

drivers ↔ List<LogDriver>
The list of active log drivers.
getter/setter pair
level ↔ LogLevel
The current minimum log level to display.
getter/setter pair
useJson ↔ bool
Whether to output logs in JSON format.
getter/setter pair

Static Methods

staticDebug(String message, [Map<String, dynamic>? data]) → void
Static helper for logging debug info.
staticError(String message, {Object? error, StackTrace? stackTrace, Map<String, dynamic>? data}) → void
Static helper for logging an error.
staticInfo(String message, [Map<String, dynamic>? data]) → void
Static helper for logging info.
staticWarning(String message, [Map<String, dynamic>? data]) → void
Static helper for logging a warning.
withContext(Context ctx) → Logger
Creates a Logger instance configured with metadata from the ctx.