JSON Loggly
A node.js module for Loggly, espcially optimized for node.js API servers that deal in JSON requests and responses and uses connect for middleware management.
When calling res.end()
, the json-loggly module will automatically log
the request to Loggly and stdout.
json-loggly can also log custom log messages and support 4 different log levels: debug, info, warning and error.
Usage
json-loggly is very simple to use. To log requests, simply:
var connect = ;var loggly = ; var { // Do your stuff here reqloggly; // if PUT or POST request with a json body, log it resloggly; // if response contains json body, log it res;}; // inject json-loggly middleware early // Your normal app request handling ;
To log a custom log message use the json-loggly methods dbg
, inf
,
war
or err
:
var loggly = ; // Provide a custom object to be loggedloggly; // Or just log a stringloggly;
License
MIT