charmbracelet / log

A minimal, colorful Go logging library 🪵
MIT License
2.4k stars 67 forks source link

Can I print errors to stderr and Info to stdout #40

Closed bbkane closed 1 year ago

bbkane commented 1 year ago

I plan to use log for longer running CLI apps and sometimes I want to do something like:

cli > /dev/null

so I can just see the errors.

If this doesn't seem like a useful feature to you, no worries, I can always just use two loggers.

aymanbagabas commented 1 year ago

Log uses os.Stderr by default. You can change the default output using log.SetOutput() or use New(io.Writer). If you want different output streams for different levels, you will have to use separate loggers.

bbkane commented 1 year ago

I just wrote a small Uber/zap wrapper for this https://github.com/bbkane/logos