Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Last active December 11, 2015 00:28
Show Gist options
  • Save dezinezync/4516501 to your computer and use it in GitHub Desktop.
Save dezinezync/4516501 to your computer and use it in GitHub Desktop.
var express = require('express');
var app = express(),
log;
app.configure('development', function() {
app.use(express.errorHandler());
log = {
info:function(e) {
console.log(e);
}
}
});
app.configure('production', function() {
var logentries = require('node-logentries');
log = logentries.logger({
token:'your-token'
});
});
app.get('/', function(req, res){
res.send('hello world');
//Now where you need to log any information, simply do this
log.info("Your log message");
//This, depending upon your applications environment, will either log it to your console or send it to logentries
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment