Custom Logger in SailsJS

652 views Asked by At

Below is my log.js file but it only logs "Hello from colorized winston", but it's not logging all my sails.log.info in my app. What am I doing wrong. I searched everywhere and can't figure it out. All I found is this https://groups.google.com/forum/#!topic/sailsjs/67u7SqzsNJQ and it seems to confirm I'm doing correctly.

var winston = require('winston'),
  Papertrail = require('winston-papertrail').Papertrail;

var logger = new winston.Logger({
  transports: [
    new Papertrail({
      host: 'logs3.papertrailapp.com',
      port: xxxxx, // my port here
      colorize: true
    })
  ]
});

logger.info('Hello from colorized winston', logger);

module.exports = {
  log: {
    custom: logger
  }
};

Any help would greatly be appreciated.

PS. I'm jumping into a project created by someone else so it's possible they broke something. If someone can give me a lead how to debug by telling me how custom works that would also be appreciated.

1

There are 1 answers

1
Bwaxxlo On

Make sure you've setup the correct logging level. In your config/log.js file, set the log level to something like level: silly. This should log pretty much everything.