node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Build Status

NodeJS module for JSLogger


$ npm install jslogger


Instatiate a logger with your secret API key. You can get your key on

var logger = require("jslogger")({key: "SECRET_KEY"});

Log an error string

logger.log("I'm an error! Log me!");

Log an error object

logger.log({auth: {error: "Sign up failed...", reason: "Bad credentials."}});

Log an event string

logger.event("We got a new signup!");

Log an event object

logger.event({auth: {action: "Sign up", username: "doomhz"}});

You can set the track to false in development or testing mode

var track = process.env.NODE_ENV === "production" ? true : false;
var logger2 = require("jslogger")({key: "SECRET_KEY", track: track});

The remote request will not be executed when track option is false

logger2.log("Non trackable error in dev mode");
logger2.event("Non trackable event in dev mode");