Skip to content

Latest commit

 

History

History
68 lines (53 loc) · 1.51 KB

README.md

File metadata and controls

68 lines (53 loc) · 1.51 KB

meteor-winston-papertrail

A wrapper around winston-papertrail for using Papertrail transport with winston for use with Meteor :)

##Install $ meteor add wylio:winston-papertrail

##Usage

Winston is exposed as:

Winston

And papertrail transport is exposed as:

Winston_Papertrail

so it can be used as follows:

Create a file called logging.js in the lib folder in the root or your app. The Lib folder is called first so that logging is exposed early on.

Don't forget to change PORT to the port number provided to you by PapertailApp.com.

if(Meteor.isServer) {

  //creating a global server logger
  log = Winston;

  log.add( Winston_Papertrail, {
  	levels: {
  		debug: 0,
  		info: 1,
  		warn: 2,
  		error: 3,
  		auth: 4
  	},
  	colors: {
  		debug: 'blue',
  		info: 'green',
  		warn: 'red',
  		error: 'red',
  		auth: 'red'
  	},

  	host: "logs.papertrailapp.com",
  	port: PORT,
  	handleExceptions: true,
  	json: true,
  	colorize: true,
  	logFormat: function(level, message) {
  		return level + ': ' + message;
  	}
  });
}

You can paste this at the bottom of the logging.js code to test that it is working correctly.

log.info(" =====> Meteor App restarted "+ new Date( Date.now()) +" <=====");

See winston-papertrail documentation for more details.