rs / zerolog

Zero Allocation JSON Logger
MIT License
10.39k stars 566 forks source link

zerolog with two ouputs: create to logging objects or just switch the Output value everytime? #616

Open muhammadthayyil opened 10 months ago

muhammadthayyil commented 10 months ago

Im doing a project that uses zerologging library for its logging support

currently im logging to console, but i was hoping to split the output stream into debugging/infos to stdOut and warns/errors to stdErr.

would it be better to create two separate logging objects, one outputting to stdOut and the other outputting to stdErr? or should i just set the Output value of the logger each time there is a switch in the logging level (debug/info -> warn/error and vice versa) which would be happen a lot of times in the project

v613 commented 9 months ago

Maybe you should try implement zerolog.ConsoleWriter

Also take a look at #150

v613 commented 8 months ago

@muhammadthayyil if I understood you correctly, here is an example: https://github.com/rs/zerolog/issues/363#issuecomment-1867803819