logging library

Classes

ErrorFault
Represents a fault caused by an Error
ExceptionFault
Represents a fault caused by an Exception
Fault
Represents a fault that occurred during program execution
MessageFault
Represents a fault with a text message
UnknownFault
Represents an unknown fault type

Enums

LogLevel
The severity of the log message

Extensions

LoggerChildExtensions on Logger
Extensions for child logger support
LoggerExtensions on Logger
Pino-style extensions for Logger
LoggingContextExtensions on LoggingContext
Extensions for the LoggingContext

Functions

createLogger(LoggingContext context) Logger
Creates a Logger from a LoggingContext (currying)
createLoggerWithContext(LoggingContext context) Logger
Creates a Logger and stores its context for child() support
createLoggingContext({List<LogTransport>? transports, LogLevel? minimumLogLevel, List<String>? extraTags, Map<String, dynamic>? bindings}) LoggingContext
Creates a logging context
logTransport(LogFunction log, {Future<void> initialize()?}) LogTransport
Creates a log transport with the specified log function and optional initialization
processTemplate(String template, Map<String, dynamic>? structuredData) String
Processes a message template by replacing placeholders with values from structured data

Typedefs

LogFunction = void Function(LogMessage, LogLevel minimumlogLevel)
A function that logs a LogMessage
Logger = void Function(String message, {required LogLevel level, Map<String, dynamic>? structuredData, List<String>? tags})
A Logger is a curried function that captures the LoggingContext Use extensions for .info(), .warn(), .error(), .child() etc.
LoggingContext = ({Map<String, dynamic> bindings, List<String> extraTags, LogLevel minimumLogLevel, List<LogTransport> transports})
The context that keeps track of the transports and configuration
LogMessage = ({Fault? fault, LogLevel logLevel, String message, StackTrace? stackTrace, Map<String, dynamic>? structuredData, List<String>? tags, DateTime timestamp})
A log message
LogTransport = ({Future<void> Function() initialize, LogFunction log})
A log transport (e.g., console, file, etc.)