warn abstract method

void warn(
  1. String message, {
  2. Object? error,
  3. StackTrace? stackTrace,
  4. Map<String, Object?>? extras,
  5. bool escalate,
})

Logs a warning for a potentially problematic situation.

Warning messages indicate issues that do not prevent operation but may require attention, such as fallback behaviour or recoverable errors.

The message describes the warning condition. The optional error and stackTrace provide exception context. The extras map may include additional context such as affected resources or retry counts. Set escalate to true to also send this warning to error tracking (Sentry).

Example:

logger.warn(
  'Token refresh response was malformed',
  extras: {'endpoint': '/api/token/refresh'},
  escalate: true,
);

Implementation

void warn(String message, {Object? error, StackTrace? stackTrace, Map<String, Object?>? extras, bool escalate});