dvLogCrashDiagnostic function

void dvLogCrashDiagnostic(
  1. String code,
  2. String message
)

Logs a DV-CRASH diagnostic at the level the registry gives it.

Implementation

void dvLogCrashDiagnostic(String code, String message) {
  final String level = DVDiagnostics.all
          .where((DVDiagnostic d) => d.code == code)
          .firstOrNull
          ?.level ??
      'warning';
  _crashLogger.log(
    '$code: $message',
    level: switch (level) {
      'debug' => DVLogLevel.debug,
      'info' => DVLogLevel.info,
      'error' => DVLogLevel.error,
      _ => DVLogLevel.warn,
    },
    context: <String, Object?>{'code': code},
  );
}