Provides flexible logging for Node.JS applications inspired by Zend Framework's Zend_Log package.
npm install logcabin
In an Express-based application you might create something like
varlogcabin =Log =logglyOptions =token: 'my-very-long-token'subdomain: 'mysubdomain'tags:auth:username: "myusername"password: "myP@ssw0rd"json:true;switch processenvNODE_ENV// on my local machine just console everythingcase 'local':Log;break;// on development and production log to logglycase 'development':case 'production':logglyOptionstags;var loggly = ;Log;moduleexports = Log;
Then in your application you could do something like this:
// be sure to point to the right path to where you saved log.jsvar log = ;// Using a Mongoose modelMyModel;