Add TextFormatter

This commit is contained in:
Genteure 2021-06-04 23:00:50 +08:00
parent 1396de8f44
commit 3d70ce6c09

View File

@ -15,6 +15,7 @@ using Serilog;
using Serilog.Core; using Serilog.Core;
using Serilog.Exceptions; using Serilog.Exceptions;
using Serilog.Formatting.Compact; using Serilog.Formatting.Compact;
using Serilog.Formatting.Display;
#nullable enable #nullable enable
namespace BililiveRecorder.WPF namespace BililiveRecorder.WPF
@ -181,6 +182,8 @@ namespace BililiveRecorder.WPF
o.DisableTaskUnobservedTaskExceptionCapture(); o.DisableTaskUnobservedTaskExceptionCapture();
o.AddExceptionFilterForType<System.Net.Http.HttpRequestException>(); o.AddExceptionFilterForType<System.Net.Http.HttpRequestException>();
o.TextFormatter = new MessageTemplateTextFormatter("[{RoomId}] {Message}{NewLine}{Exception}{@ExceptionDetail:j}");
o.MinimumBreadcrumbLevel = Serilog.Events.LogEventLevel.Debug; o.MinimumBreadcrumbLevel = Serilog.Events.LogEventLevel.Debug;
o.MinimumEventLevel = Serilog.Events.LogEventLevel.Error; o.MinimumEventLevel = Serilog.Events.LogEventLevel.Error;