Builds on LoggerJS's skeleton to provide similar logging functionalities for Node.js modules.
Features:
- Uses the console to output information to the Browser Developer Tools.
- Supports sending the log entry (as JSON) to some Log Server.
- Supports write to log files
- custom tasks to be processed on specified log levels.
- Handles unexpected errors in the window.
- Handles process exits => report shutdown and kill
Please report bugs there on GitHub.
Add following entry to your package.json
in the dependencies
property
"dependencies": {
"loggerjs" : "0.0.x"
},
Use a Logger instance in a Node.js module
var LoggerJS = require('loggerjs'),
options = {
namespace : 'my.awesome.project',
status : true,
logLevel : LoggerJS.DEBUG,
logServerUrl : '<logging_service_url>',
tags : ['myproject', 'node', 'something']
},
logger = new LoggerJS.Logger(options);
please refer to the LoggerJS README for an up to date list of options.
please refer to the LoggerJS README for an up to date API description.
Activates writing log entries to files.
Parameter:
- path: absolute path to the logfile
Example:
// activates file logging
logger.useLogfile(<path>);
Enables logfile task.
Example:
// enables file logging
logger.enableLogfile();
Disables logfile task.
Example:
// disables file logging
logger.disableLogfile();