log method
void
log(
- String message, {
- required LogLevel level,
- Object? error,
- StackTrace? stackTrace,
- Map<
String, Object?> ? context, - bool printStackTrace = true,
- bool printError = true,
override
Logs a message with the specified level
.
Implementation
@override
void log(
String message, {
required LogLevel level,
Object? error,
StackTrace? stackTrace,
Map<String, Object?>? context,
bool printStackTrace = true,
bool printError = true,
}) {
if (_destroyed) {
_log('Logger has been destroyed. It cannot be used anymore.');
return;
}
final LogWrapper logMessage = LogWrapper(
message: LogMessage(
message: message,
level: level,
timestamp: clock.now(),
error: error,
stackTrace: stackTrace,
context: context,
),
printStackTrace: printStackTrace,
printError: printError,
);
_controller.add(logMessage);
}