pgiani / clean_logs

A better console.log for the browser
223 stars 6 forks source link

Possible to change logging levels at runtime? #6

Open fiznool opened 6 years ago

fiznool commented 6 years ago

Nice module!

I was wondering if it is possible to change the logging level at runtime. I can imagine a scenario where logging is set to CRITICAL by default on a production app, but when debugging in production it might be nice to set the log level to DEBUG in the Chrome console. This would produce all debug logs and above from that point onwards.

Is this possible?

pgiani commented 6 years ago

At the moment you can't change the logging level at runtime that way it is now, you would need to write custom code on your app to do it. If I need it to implement it on my app I would make a wrapper around this module and have the Loggin level tie to a props value that you can change at run time.

I use this module in a wrapper while in development mode and production I send the messages to the database, but the code is specific to MeteorJS that is why I did not include the logic here.