0.0.2 • Published 6 years ago
connect-node v0.0.2
connect-node
All nodejs artifacts related to the Connect project.
Description
It is a simple and JSON library for node.js services to print out log in JSON format for elastic search.
Initial logger:
const logger = require('connect-node').createLogger({appName: 'dashboard'}); // appName is required
logger.info('hello, clearpoint-connect!');
Installation Instructions
$ npm install connect-node
Logger Level
trace, debug, info, warn and error
Logger API
logger.log(LOG_LEVEL, MESSAGE, PAYLOAD); // LOG_LEVEL must be string
logger.trace( MESSAGE, PAYLOAD); // The MESSAGE(first) field is required, the second field can be optional
logger.debug( MESSAGE, PAYLOAD);
logger.info( MESSAGE, PAYLOAD);
logger.warn( MESSAGE, PAYLOAD);
logger.error( MESSAGE, PAYLOAD);
Example 1:
logger.trace('hello, clearpoint-connect!');
Output will be like:
{
"appName":"dashboard",
"priority":"REST",
"message":"hello, clearpoint-connect!"
}
Example 2:
logger.log('VERBOSE', 'hello, clearpoint-connect!');
Output will be like:
{
"appName":"dashboard",
"priority":"VERBOSE",
"message":"hello, clearpoint-connect!"
}
Example 3:
logger.trace('Send POST request', {url: 'https://www.google.com', method: 'POST', status: 200});
Output will be like:
{
"appName":"dashboard",
"priority":"REST",
"message":"Send POST request",
"payload":"{\"status\":200,\"url\":\"https://www.google.com\",\"method\":\"POST\"}"
}
Connect is a Continuous Delivery Platform that gathers best practice approaches for deploying working software into the cloud with confidence.
The main documentation for Connect can be found at docs.connect.cd
Any queries on the Connect platform can be sent to: connect@clearpoint.co.nz