Use a logger with different logging levels
See original GitHub issueCurrently, inside of the Guess.js webpack plugin there are a lot of statements in the form:
if (this._config.debug) {
console.warn(...);
}
Instead of having this duplication of this._config.debug
checks, it’d be better if we isolate the logic into a logger with different logging levels. We can either create a custom logger (no dependencies, smaller payload) or go with an existing one (code reuse).
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Logging Levels: What They Are & How to Choose Them
A log level used for events considered to be useful during software debugging when more granular information is needed. Trace, A log level...
Read more >How to set different levels for different python log handlers
You can set a different logging level for each logging handler but it seems you will have to set the logger's level to...
Read more >How to Choose Levels of Logging - Section.io
Logging levels explained. The most common logging levels include FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL, and OFF. Some of them are ...
Read more >Understanding logging levels - IBM
Each log message has an associated log level that gives a rough guide to the importance and urgency of the message. Each level...
Read more >Python Logging Levels Explained - LogicMonitor
The logger can then be used to send out simple formatted messages at different logging levels (such as DEBUG, INFO, ERROR), which the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vprasanth looks great! Just merged the PR which introduced the logger & the initial refactoring. Feel free to replace the other
console
occurrences 😃Hey, sorry for the delay, was at a cottage this weekend 😃
Anyways, I ended up adding a couple more log levels – but set the logger to
DEBUG
. I added the additional levels to covererror
andwarn
. So in total there isDEBUG
,INFO
,WARN
,ERROR
, andOFF
. Default for the logger is set toINFO
.I’ve so far only updated the
prefetch-aot-plugin
file, I noticed some other places within the guess-webpack package that useconsole
, wasn’t sure if you wanted those updated as well. Figured I’d wait for a review then update the rest if wanted. Let me know 😃