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!
Hello,
I am trying to accomplish a logging on different channel depending on the level of the log.
<= Warning, then log tostdout>= Error, then log tostderrIs there a way to get this work ?
For now I got
But with this, I see error logs output both in Stdoud and Stderr
Thank you for your help!