NodeJS module for JSLogger
CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
spec
.gitignore
.travis.yml
README.md
package.json

README.md

jslogger-node

Build Status

NodeJS module for JSLogger

Installation

$ npm install jslogger

Documentation

Instatiate a logger with your secret API key. You can get your key on http://jslogger.com/manage/#code.

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");