fatal method

Future<void> fatal(
  1. dynamic error, {
  2. StackTrace? stackTrace,
  3. LogEvent? event,
  4. Map<String, Object>? context,
})

Logs a fatal error using the configured strategies.

Throws NotInitializedError if the logger has not been initialized.

error - The critical error object to log as fatal. stackTrace - The stack trace associated with the fatal error. event - Optional. The specific log event associated with the fatal error. context - Optional. Additional context data.

Implementation

Future<void> fatal(
  dynamic error, {
  StackTrace? stackTrace,
  LogEvent? event,
  Map<String, Object>? context,
}) async {
  if (!_isInitialized) {
    throw NotInitializedError();
  }

  final entry = LogEntry.fromParams(
    message: error,
    level: LogLevel.fatal,
    event: event,
    context: context,
    stackTrace: stackTrace,
  );

  _logQueue.enqueue(entry);
}