Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override Default Level Per Sink #104

Closed
clmcgrath opened this issue Apr 20, 2018 · 3 comments
Closed

Override Default Level Per Sink #104

clmcgrath opened this issue Apr 20, 2018 · 3 comments
Labels

Comments

@clmcgrath
Copy link

clmcgrath commented Apr 20, 2018

I would like to limit one of my sinks to only log warnings and errors
and have my other sinks log at the debug / verbose level

In the c# api you can specify restrictedToMinimumLevel per sink
is there a way to set this level via settings binding

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Debug()
    .WriteTo.File("log.txt")
    .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Information)
    .CreateLogger();

ie

    "WriteTo": [
      {
        "Name": "Console", 
        "MinimumLevel" :  "Debug"
      },
@nblumhardt
Copy link
Member

Hi!

    "WriteTo": [
      {
        "Name": "Console", 
        "Args": {"restrictedToMinimumLevel" :  "Debug"}
      },

should do it. HTH!

@clmcgrath
Copy link
Author

works for me 👍
i understand the reason for it after looking through how configuration is bound to the framework , but i would think this should be a top level configuration setting using a similar convention to the default setting

@nblumhardt
Copy link
Member

Thanks for the follow-up and feedback, Chris 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants