Logging

Logging functionality is provided by serviser-logger package (which comes with serviser as one of the dependencies) whose configuration defaults to file system logging to process.cwd() + '/logs' directory.
By default only uncaughtExceptions and errors will be logged (warnings and other non-critical data are excluded).

The service logging can be reconfigured by providing your $PROJECT_ROOT/config/config.js config file with logs section:
(It will get fetched automatically once on a Service instantiation )

{
    logs: {
        exitOnError: false,  // determines whether a process will exit with status code 1 on 'uncaughtException' event
        transports: [
            {
                type: 'file',
                level: 'error', // maximum log level of this sepecific transport, [optional]
                priority: 1, //transports with highest priority are elected to be major logging players with fallbacks to transports with lower priority
                dir: 'logs', // can be absolute or relative to the node's process
                autocreate: true // whether the `dir` should be created if it does not exist
            },
            {
                type: 'console',
                level: 'uncaughtException',
                priority: 2
            }
        ]
    }
}

For futher information about logging configuration and behavior see the serviser-logger's README.

Next: CLI Interface tutorial.

comments powered by Disqus