errorWithContext static method
void
errorWithContext(})
Enhanced error logging with context (para ANY component)
Implementation
static void errorWithContext(
String component, String operation, String error, StackTrace? stackTrace,
{Map<String, dynamic>? context}) {
// Always log errors regardless of level
final contextStr =
context != null ? ' | Context: ${_formatData(context)}' : '';
final message = '💥 $component - $operation ERROR: $error$contextStr';
if (component.toLowerCase().contains('rule')) {
_logWithPrefix(_rulePrefix, 'ERROR', message, error, stackTrace);
} else if (component.toLowerCase().contains('http')) {
_logWithPrefix(_httpPrefix, 'ERROR', message, error, stackTrace);
} else if (component.toLowerCase().contains('ui')) {
_logWithPrefix(_uiPrefix, 'ERROR', message, error, stackTrace);
} else if (component.toLowerCase().contains('storage')) {
_logWithPrefix(_storagePrefix, 'ERROR', message, error, stackTrace);
} else {
_log('ERROR', message, error, stackTrace);
}
}