ang-logger v1.1.5
ANG Logger
This module aims to manage logs of all ANG projects. It will be a part of ANG node modules
Before Loading project
Make sure you declare the required env variable in your project. These variables will be used this module
List of vars :
GRAYLOG_URI
GRAYLOG_PORT
SLACK_WEBHOOK_URL
SLACK_CHANNEL
DISABLE_LOG
*False by default
Using the module
To use this module, simply call it with :
import log from 'ang-logger';
And call the level you need
function with JSON parameter
of what you need to log.
4 levels in ANG projects:
log.info
Will call the standard output process.stdout.write
log.error
Will call the error output process.stderr.write
log.warn
Will send data to graylog, it is used when there is http errors
log.fatal
Will send data to slack, it is used only when a fatal error happens: '503 '
Level | Output |
---|---|
info | process.stdout.write |
error | process.stderr.write |
warn | Graylog |
fatal | Slack |
Switching logs:
If an error occurs when trying to send data to graylog, the logger will automatically swith all the warn error to Slack. And viceversa, if an error occurs in Slack, we send data to graylog. This will ensure that the actual log will be sent.