@e3o/logger
v1.0.1
Published
Global logger service
Downloads
2
Readme
Logger
How to install and run this module ?
- Import the module in your app
- You need to create a logger object using the 'new' operator to be able to use the logger. Constructor takes one argument which is the configuration object.
- The configuration object MUST contain the following properties :
- 'APP_NAME'
- 'LOG_LEVEL'
Methods available
warning: will print a warning message (yellow)
error: print an error message (red)
emerg: print an emerg message (white)
debug: print a debug message (green) Be careful, debug level must be enabled in your config in order to print debug messages
info: print an info message(gray) Each of these methods takes 2 arguments :
- { String } message you want to print
- { Object } object you want to print (must not be stringified)
Miscellaneous
Format of the message (don't include the object you'd like to print): timestamp level: message The timestamp will print a date with the format: YYYY-MM-DD HH:mm:ss