mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 44 forks source link

Disable the logger #51

Closed SvetoslavStefanov closed 6 years ago

SvetoslavStefanov commented 6 years ago

Hello, How can I disable the logger ? I want the logger to be enabled only on production.

mperdeck commented 6 years ago

To enable/disable the entire library (that is, all loggers), set the enabled field: http://jsnlog.com/Documentation/Configuration/JSNLog http://jsnlog.com/Documentation/JSNLogJs/JL/SetOptions

SvetoslavStefanov commented 6 years ago

I just want to add one thing, that might confuse someone, as it confused me. JL.setOptions({ "appenders": [appender], "enabled": !backEndConfig.config.canDebug }); To set options call JL. and not JL().setOptions, because the second one wouldn't set "enabled" to false, and there is no error for calling JL(). so it's a bit hard to catch this.