Simple JS Logger.
Allow you to manage logging in Javascript browser console.
In replacement of console.log using for quality and configuration purpose.
- Easy to use
- No dependency.
- 4 Ko only
- 2 minutes setup
- "Framework agnostic": can work on pretty much all libraries
Inspired by Log4J.
You have can use logger with following logging level with associated method
- trace (default level, if configuration not set)
Provide full stack strace
logger.trace("my message");
- debug
- info
- warn
- error / fatal
Logging messages will be displayed in differents colors, depends on the criticity level.
It will provide details about message origin location and give stack trace for message :
gkjs-log provide optionnal feature to display warning about console usage for end-users.
You can personnalize message by
- using _config.logger.messages configuration settings
- using GKJS.i18n features on AppTitle and ConsoleWarning codes
On applicaton bootstrap, you have to provide _config global variable with following properties
var _config = {
/* Debug mode activation. */
debug: true,
logger: {
/** Configure log level
* 1 : Trace
* 2 : Debug
* 3 : Info
* 4 : Warn
* 5 : Error
**/
level:2,
/* Display console disclaimer */
disclaimer: true,
/* Optionnal */
messages: {
appTitle: "<my-title>",
consoleWarning: "MyWarning"
}
}
}
You can activate logger in production environment just by typing following instruction
logger.activeDebugMode()
Usefull for bug analysis in production environments.
Based on console javascript object feature
- Does not work on old browsers
- Library does not trigger any exception with old browsers which not provide console JS object.
Free to use.
Apache2 License