1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Add log level translation

This commit is contained in:
Dean Herbert 2022-05-10 14:08:42 +09:00
parent dc3c73f723
commit 09c21cde8c

View File

@ -50,12 +50,37 @@ namespace osu.Game.Utils
if (lastException != null && lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace, StringComparison.Ordinal)) return;
lastException = exception;
sentry.CaptureEvent(new SentryEvent(exception) { Message = entry.Message }, sentryScope);
sentry.CaptureEvent(new SentryEvent(exception)
{
Message = entry.Message,
Level = getSentryLevel(entry.Level),
}, sentryScope);
}
else
sentryScope.AddBreadcrumb(DateTimeOffset.Now, entry.Message, entry.Target.ToString(), "navigation");
}
private SentryLevel? getSentryLevel(LogLevel entryLevel)
{
switch (entryLevel)
{
case LogLevel.Debug:
return SentryLevel.Debug;
case LogLevel.Verbose:
return SentryLevel.Info;
case LogLevel.Important:
return SentryLevel.Warning;
case LogLevel.Error:
return SentryLevel.Error;
default:
throw new ArgumentOutOfRangeException(nameof(entryLevel), entryLevel, null);
}
}
private bool shouldSubmitException(Exception exception)
{
switch (exception)