log method
void
log(
- Level level,
- String message,
- String scope,
- dynamic exception,
- StackTrace? stackTrace,
- LoggerFormatter formatter,
Writes a log entry.
level is the severity level of the log.
message is the log message.
scope is the scope or context of the log.
throwable is an optional error or exception associated with the log.
stackTrace is an optional stack trace associated with the log.
formatter is a function to format the log message.
Implementation
void log(
Level level,
String message,
String scope,
dynamic exception,
StackTrace? stackTrace,
LoggerFormatter formatter,
) {
final formattedMessage = formatter(
LogContext(
level: level,
message: message,
timestamp: DateTime.now(),
scope: scope,
throwable: exception,
stackTrace: stackTrace,
),
dateFormatter,
);
LogDispatcher.log(id, formattedMessage);
}