serilog icon indicating copy to clipboard operation
serilog copied to clipboard

Dotnet MAUI - Serilog to convert log output levels thrown by Microsoft internal classes

Open wangyupengfil opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. The serilog library is integrated into the MAUI project. For the logs thrown by the following Microsoft internal classes, does serilog support converting the log level from [WRN] to [DBG]?

[WRN] [] (Microsoft.Maui.Controls.Element) Microsoft.Maui.Controls.PanGestureRecognizer is already a child of XXXXXX Remove Microsoft.Maui.Controls.PanGestureRecognizer from XXXXXX before adding to Microsoft.Maui.Controls.Grid.
[WRN] [] (Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics) '"Path"' property not found on '"XXXXXX"'.
[WRN] [] (Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics) '"Content"' property not found on XXXXXX

Describe the solution you'd like Expect Serilog to support a configuration or method that can support converting the output level of logs in a certain type of namespace.

Describe alternatives you've considered After trying some configurations, I couldn't achieve the expected results. Maybe it's because the logs I want to process are thrown internally by the MAUI framework rather than defined by myself?

"Serilog": {
  "MinimumLevel": {
    "Default": "Information",
    "Override": {
      "Microsoft": "Debug",
      "System": "Debug"
    }
  }
}

I also tried the serilog filtering method. This method can only achieve the filtering effect and cannot customize the log level conversion. Filter.ByExcluding()...

wangyupengfil avatar Jun 18 '24 05:06 wangyupengfil

Hi! It's not clear exactly what you are aiming to do - I'd recommend raising this one on Stack Overflow with the serilog tag, there are limited watchers on this repo. Best of luck with it!

nblumhardt avatar Jun 18 '24 06:06 nblumhardt