e method

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

Logs an error message with optional details and stack trace.

The error message is displayed with the prefix ERROR. If an error or stackTrace is provided, they are also logged.

Example:

logger.e('An error occurred', error: someError, stackTrace: someStackTrace);

Implementation

void e(String message, {Object? error, StackTrace? stackTrace}) {
  if (_shouldLog()) {
    debugPrint('ERROR: $message');
    if (error != null) debugPrint('Error details: $error');
    if (stackTrace != null) debugPrint('Stack trace: $stackTrace');
  }
}