SBIS3 Cloud Logger
Install
npm install sbis3-cloud-logger --save
Use
Module exports a singleton object (only one instance per working process).
var logger = ;
Before sending logs, it must be configured using init()
method.
Pass options object to init()
to set logger options.
// If both url and cloud is set - priority to cloud// You MUST specify one of themlogger;
After first call to init()
is made, all further call will be completely ignored.
If cloud
parameter is not set while doing init()
, exception is thrown.
When done with initialization, use log()
method.
logger;logger;logger;
Instead of passing a text message as a first parameter, one can pass object with fields:
- msg
- method
- extip
- intip
logger;
If init()
is not done, all calls to log()
is useless and completely ignored.
If you need to forcibly flush logs, use flush()
method (since 0.2.0 it flushes logs immediately,
not on a next timer tick as of 0.1.0).
To terminate logger (this will prevent further logs transmission) use end()
method.
Both methods accepts optional callback which will fire when logs are flushed or error occurs during sending logs.
Hacks
If DISABLE_CLOUD_LOG
environment variable is set, logger is doing nothing. All calls to log()
are ignored.