Logger class final

Structured logger with channels, scope context and redaction (BLUEPRINT_V2 §7.10.3).

Constructors

Logger({LogLevel minimumLevel = .debug, StringSink? out, StringSink? err, List<LogHandler>? handlers, String channel = 'default', List<String> redact = LoggingConfig.defaultRedactedKeys})
Console logger; pass handlers to replace the console output.
Logger.fromConfig(LoggingConfig config, {required String basePath, LogLevel? minimumLevel})
Builds the default channel and every named channel from config.
factory

Properties

channel → String
Channel name stamped on every record.
final
handlers → List<LogHandler>
no setter
hashCode → int
The hash code for this object.
no setterinherited
minimumLevel → LogLevel
Messages below this level are dropped.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scopeContext → Map<String, Object?>
Context of the current scope (empty outside a scope).
no setter
sharedContext → Map<String, Object?>
no setter

Methods

addHandler(LogHandler handler) → void
channelNamed(String name) → Logger
A named channel (Log::channel('daily')); channel itself returns this logger.
close() → Future<void>
Flushes and closes every handler of this logger and its channels.
critical(String message, {Object? error, StackTrace? stackTrace, Map<String, Object?>? context}) → void
debug(String message, [Map<String, Object?>? context]) → void
error(String message, {Object? error, StackTrace? stackTrace, Map<String, Object?>? context}) → void
info(String message, [Map<String, Object?>? context]) → void
log(LogLevel level, String message, {Object? error, StackTrace? stackTrace, Map<String, Object?>? context}) → void
Writes one record to every handler.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notice(String message, [Map<String, Object?>? context]) → void
redact(Map<String, Object?> context) → Map<String, Object?>
Replaces values of sensitive keys (recursively) with [REDACTED].
registerChannel(String name, Logger logger) → void
Registers (or replaces) a named channel.
removeHandler(LogHandler handler) → bool
shareContext(Map<String, Object?> context) → void
Context added to every record of every channel (Log::shareContext).
toString() → String
A string representation of this object.
inherited
warning(String message, [Map<String, Object?>? context]) → void
withContext(Map<String, Object?> context) → void
Adds context to the current request/job scope, or shares it when no scope is active (Log::withContext).

Operators

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