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

Question: Can you set maximum logging level #146

Open
pelletier197 opened this issue Jun 24, 2020 · 1 comment
Open

Question: Can you set maximum logging level #146

pelletier197 opened this issue Jun 24, 2020 · 1 comment

Comments

@pelletier197
Copy link

pelletier197 commented Jun 24, 2020

Hello,

I am trying to accomplish a logging on different channel depending on the level of the log.

  • If logging level is <= Warning, then log to stdout
  • if logging level is >= Error, then log to stderr

Is there a way to get this work ?

For now I got

	backend := logging.NewLogBackend(os.Stdout, "", 0)
	leveledConsoleBackend = logging.AddModuleLevel(backend)
        // ...
	errorBackend := logging.NewLogBackend(os.Stderr, "", 0)
	leveledConsoleErrorBackend = logging.AddModuleLevel(errorBackend)
	leveledConsoleErrorBackend.SetLevel(logging.ERROR, "")

	logging.SetBackend(leveledConsoleErrorBackend, leveledConsoleBackend)

But with this, I see error logs output both in Stdoud and Stderr

Thank you for your help!

@ORESoftware
Copy link

ORESoftware commented Sep 18, 2020

I opened a ticket in July lol, waiting for a response :(

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

No branches or pull requests

2 participants