Closed slifty closed 4 years ago
Yes, I think that's right for trace and debug at least. Possibly not error. What you might want to do is establish a log level, put it in an environment variable and then mute everything beneath that.
OK, sounds like this would be good:
LOG_LEVEL
)On a related note, I'd like to modify the default logger to never use console.trace
<-- that outputs a full stack trace in addition to the message, which is quite noisy!
No standard name seems to exist, so we could either do LOG_LEVEL
or we can do something more unique to TVK such as TVK_LOG_LEVEL
.
Here's what is tripping me up: a dev can pass their own logger and bypass this. We want the default behavior to be good behavior, but I'm wary of overcomplicating by providing too many ways to customize logging...
Here are some options in front of me:
Have the default logger be COMPLETELY silent at all levels. The developer would have to pass a logger if they want any form of logging.
Have the default logger silence debug and trace, and always output above that. A developer who wants different behavior must pass their own logger to change it.
Have the default logger use an environment variable (e.g. TVK_LOG_LEVEL
) with a default value of INFO
. The developer could then change log levels without having to pass a custom logger.
None of the above -- don't look at environment variables at all, and instead have a logLevel
config value that is passed to the Countertop.
kafkajs uses option 4, and we probably should do that too.
Moving back to 1: default of no logging (silent logger). If an application wants to have logging, they provide a logger that isn't silent, configured to the levels they want.
Task
Description
The default logger writes to console, which is cool and all, except this means that the default behavior is to log everything to console (e.g. including trace).
It would probably be friendly to not do that.
Not going to implement this until after we discuss though, since I don't want to keep painting the logger bike shed for all eternity.
Relevant Resources / Research
Nah
Related Issues
Nope