log<TState> method
void
log<TState>({
- required LogLevel logLevel,
- required EventId eventId,
- required TState state,
- Object? error,
- required LogFormatter<
TState> formatter,
override
Writes a log entry.
Implementation
@override
void log<TState>({
required LogLevel logLevel,
required EventId eventId,
required TState state,
Object? error,
required LogFormatter<TState> formatter,
}) {
if (!isEnabled(logLevel)) {
return;
}
var formattedMessage = formatter(state, error);
if (formattedMessage.isEmpty) {
return;
}
var message = '${logLevel.name}: $formattedMessage';
// if (error != null) {
// message = '$message';
// }
developer.log(
message,
time: DateTime.now(),
level: _getLogLevel(logLevel),
name: _name,
error: error,
);
}