3 ms·
Log structurally, have option for human readable output is probably the sane default approach here. Sometimes you just want to run an app from commandline, send
by xani_ 4y ago
Log structurally, have option for human readable output is probably the sane default approach here. Sometimes you just want to run an app from commandline, send a request to it and see what happens
- jrockway 4y agoI could go either way on making it optional. I try to avoid configuration complexity and the log format is a piece of complexity that can be removed from your application with post-processing. For example, I wrote opinionated-server which lets you pick text or JSON logging. Even though it has text logging, when I'm developing a server locally, I just pipe the JSON through jlog because I have super-refined that format to my personal tastes, whereas zap's builtin text format isn't as nice. But I will say that when I create loggers for unit tests, I use the text formatter if one is available. I have never been interested in parsing JSON logs interspersed among plain text (though it is totally very possible to do).