pimterry / loglevel

:ledger: Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods
MIT License
2.62k stars 157 forks source link

How can I display loglevel on each message? #113

Closed aguynamedben closed 7 years ago

aguynamedben commented 7 years ago

Is there a way to display the loglevel for each message so when messages are logged in my console it's easy to tell which level it's at?

Code:

log.setLevel('debug');
log.debug('This is a debug message');

Console Output:

This is a debug message

Desired Console Output:

DEBUG: This is a debug message
asasine commented 7 years ago

A common way is to use plugins. The one I use is linked in the readme https://github.com/kutuluk/loglevel-plugin-prefix

aguynamedben commented 7 years ago

Oh, cool sorry, missed that... closing. Thanks for the help, I love this library and have used it on multiple projects over the past few years.