Skip to content

Configuration option to exclude specific namespaces #12

@hokagedami

Description

@hokagedami

Feature Request

It would be helpful to have configuration options to exclude specific namespaces from the call stack output.

Use Case

In our application, we have several infrastructure namespaces that add noise to the call stack:

  • Microsoft.AspNetCore.*
  • System.Threading.*
  • EntityFramework.*

Proposed API

Log.Logger = new LoggerConfiguration()
    .Enrich.WithCallStack(opts => opts
        .ExcludeNamespaces("Microsoft.AspNetCore", "System.Threading")
        .ExcludeByPattern("*.Infrastructure.*"))
    .CreateLogger();

Expected Output

Instead of:

MyApp.Services.UserService:42 --> Microsoft.AspNetCore.Mvc.Controller:123 --> MyApp.Controllers.UserController:15

Show:

MyApp.Services.UserService:42 --> MyApp.Controllers.UserController:15

This would make the call stacks much cleaner and more focused on application-specific code.

Priority

Medium - would significantly improve usability in enterprise applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions