Client logger library for enhanced logging
Client library for enhancing browser's console. It allows you to define logging level and therefore control what get's logged and what not.
In terminal run:
npm install --save @mjamsek/logger
To use logger, all you need to do is to use this call:
Logger.getInstance().log("Hello world!");
// outputs: Hello world!
By default, log level is set to INFO. You can change the level with call:
Logger.setLogLevel(LogLevel.WARN);
Available log levels:
- DEBUG
- FINEST
- FINE
- INFO (default)
- WARN
- ERROR
- OFF (disables logging)
Setting log level means all lower levels will not be logging messages anymore.
Logger.setLogLevel(LogLevel.DEBUG);
Logger.getInstance().debug("Hello debug!");
Logger.getInstance().info("Hello info!");
// outputs:
// Hello debug!
// Hello info!
Logger.setLogLevel(LogLevel.INFO);
Logger.getInstance().debug("Hello debug!");
Logger.getInstance().info("Hello info!");
// outputs:
// Hello info!
You can also set prefix to separate your logs from other logs that may be used in application.
Logger.setPrefix("MyApp");
Logger.getInstance().info("Hello world!");
// outputs: [MyApp] Hello world!
Recent changes can be viewed on Github on the Releases Page
See the contributing docs
When submitting an issue, please follow the guidelines.
MIT