error method

void error(
  1. String message, {
  2. Object? error,
  3. StackTrace? stacktrace,
})

Logs a message at the ERROR level.

Used when an operation fails but the app can still continue.

Example:

log.error('Failed to load configuration file.', error: e, stacktrace: s);

Implementation

void error(String message, {Object? error, StackTrace? stacktrace}) {
  add(LogLevel.ERROR, message, error: error, stacktrace: stacktrace);
}