error method
Future<void>
error(
- dynamic error, {
- StackTrace? stackTrace,
- LogEvent? event,
- Map<
String, Object> ? context,
Logs an error using the configured strategies.
Throws NotInitializedError if the logger has not been initialized.
error
- The error object to log.
stackTrace
- The stack trace associated with the error.
event
- Optional. The specific log event associated with the error.
context
- Optional. Additional context data.
Implementation
Future<void> error(
dynamic error, {
StackTrace? stackTrace,
LogEvent? event,
Map<String, Object>? context,
}) async {
if (!_isInitialized) {
throw NotInitializedError();
}
final entry = LogEntry.fromParams(
message: error,
level: LogLevel.error,
event: event,
context: context,
stackTrace: stackTrace,
);
_logQueue.enqueue(entry);
}