node.js - Sailsjs - Custom Logging with Winston -


I am currently trying to write a custom logger for sailsjs that would be used to either S3 bucket or a Mangoddab database.

Documentation is lacking, but so far I've found it:

  var custom_logger = new winston.logger ({transports: [new (winston.transports. File)) ({level: 'debug', filename: './logs/my_log_file.log'})]}); Module.exports.log = {colors: false, // custom to receive custom log without prefix or color coding: custom laser};   

What is not working for me.

Any thoughts?

inside a config file Create a new JS file (inside this code will be executed automatically by Sail) and adds Mangondab Transport as below;

  var winston = require ('winston') ; Var requires Mongo DB = ('Winston-Mangode'). Mongodibi; Var customLogger = new (winston.Logger) ({transports: [new (winston.transports.MongoDB) ({db: 'mongodb: // localhost: 27017 / test', collection: 'log', level: 'debug'} )]}); Module.exports.logging = {colors: false, // custom to receive custom log without prefix or color coding: custom laser};   

and use it anywhere

  sails.config.logging.custom.debug ("Winston Mongodb Transport Logging");    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -