I'm using zerolog for Go logging:
zerolog.SetGlobalLevel(zerolog.InfoLevel)
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: "15:04:05"})
This prints all the messages into the os.Stderr, but I want to split the logs into multiple outputs, with the next condition:
DebugLevel, InfoLevel, and WarnLevel will be printed to os.Stdout,
and ErrorLevel, FatalLevel, and PanicLevel will be printed to os.Stderr.
How can I achieve that?
You could implement LevelWriter. For example (playground):