Skip to content

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

@wangyupengfil

Description

@wangyupengfil

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()...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions