onjara / optic

A powerful logging framework for Deno
MIT License
44 stars 4 forks source link

Log to stderr by default #2

Closed iacore closed 2 years ago

iacore commented 2 years ago

Thank you for making this wonderful library!

I think it's better to write to stderr than stdout by default. By UNIX convension stdout and stdin are for process communication.

cknight commented 2 years ago

Thanks for your feedback. Digging into this deeper, the convention seems to be to use stderr for warning/error console logs and to use stdout for info/debug console logs. This is how Deno itself routes the various console methods (e.g. console.info routes to stdout, while console.error routes to stderr). I have a new commit landing shortly which will address this difference.

cknight commented 2 years ago

Release 1.3.5 contains the change to stream output. Logging to Level.Warn, Level.Error or Level.Critical will now delegate to Deno's console.warn or console.error which both output to stderr. All other logging levels will output to stdout as usual.