mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
WPF: Update sentry config
This commit is contained in:
parent
1eb71c66e0
commit
b931e24523
|
@ -465,13 +465,16 @@ namespace BililiveRecorder.Core
|
||||||
if (this.RoomConfig.AutoRecord)
|
if (this.RoomConfig.AutoRecord)
|
||||||
{
|
{
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// 定时主动检查不需要错误重试
|
// 定时主动检查不需要错误重试
|
||||||
|
|
||||||
await this.FetchRoomInfoAsync().ConfigureAwait(false);
|
await this.FetchRoomInfoAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
if (this.Streaming && this.AutoRecordForThisSession && this.RoomConfig.AutoRecord)
|
if (this.Streaming && this.AutoRecordForThisSession && this.RoomConfig.AutoRecord)
|
||||||
this.CreateAndStartNewRecordTask();
|
this.CreateAndStartNewRecordTask();
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace BililiveRecorder.WPF
|
||||||
levelSwitchConsole = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Error);
|
levelSwitchConsole = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Error);
|
||||||
logger = BuildLogger();
|
logger = BuildLogger();
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
|
||||||
Log.Logger = logger;
|
Log.Logger = logger;
|
||||||
SentrySdk.ConfigureScope(s =>
|
SentrySdk.ConfigureScope(s =>
|
||||||
{
|
{
|
||||||
|
@ -153,9 +154,10 @@ namespace BililiveRecorder.WPF
|
||||||
.WriteTo.File(new CompactJsonFormatter(), "./logs/bilirec.txt", shared: true, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true)
|
.WriteTo.File(new CompactJsonFormatter(), "./logs/bilirec.txt", shared: true, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true)
|
||||||
.WriteTo.Sentry(o =>
|
.WriteTo.Sentry(o =>
|
||||||
{
|
{
|
||||||
o.Dsn = "https://7c6c5da3140543809661813aaa836207@o210546.ingest.sentry.io/5556540";
|
o.Dsn = "https://ecd9c92010ad47e7a787bb8fc47281e3@o210546.ingest.sentry.io/5556540";
|
||||||
|
|
||||||
o.DisableAppDomainUnhandledExceptionCapture();
|
o.DisableAppDomainUnhandledExceptionCapture();
|
||||||
|
o.DisableTaskUnobservedTaskExceptionCapture();
|
||||||
o.AddExceptionFilterForType<System.Net.Http.HttpRequestException>();
|
o.AddExceptionFilterForType<System.Net.Http.HttpRequestException>();
|
||||||
|
|
||||||
o.MinimumBreadcrumbLevel = Serilog.Events.LogEventLevel.Debug;
|
o.MinimumBreadcrumbLevel = Serilog.Events.LogEventLevel.Debug;
|
||||||
|
@ -179,6 +181,10 @@ namespace BililiveRecorder.WPF
|
||||||
logger.Fatal(ex, "Unhandled exception from Application.UnhandledException");
|
logger.Fatal(ex, "Unhandled exception from Application.UnhandledException");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HandleProcessCorruptedStateExceptions, SecurityCritical]
|
||||||
|
private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) =>
|
||||||
|
logger.Error(e.Exception, "Unobserved exception from TaskScheduler.UnobservedTaskException");
|
||||||
|
|
||||||
[HandleProcessCorruptedStateExceptions, SecurityCritical]
|
[HandleProcessCorruptedStateExceptions, SecurityCritical]
|
||||||
private static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) =>
|
private static void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) =>
|
||||||
logger.Fatal(e.Exception, "Unhandled exception from AppDomain.DispatcherUnhandledException");
|
logger.Fatal(e.Exception, "Unhandled exception from AppDomain.DispatcherUnhandledException");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user