Tag: winston

Node.js Winston日志logging – exitOnError

我对这意味着什么有点困惑。 温斯顿的github页面上有一个“解释”,说你可以退出或不退出。 这是否意味着Winston对象死亡或停留,或者node.js进程是死亡还是停留? 还是其他什么东西? 我找不到任何像样的解释。

在node.js winston中添加行号configuration以logging日志时,时间戳会消失

我正在使用winston做一个自我logging器,它允许我在logging中添加时间戳和行号。 代码可以完成每个function,但是当它们合并时,它们不能按预期工作。 // **help to add timestamp** var logger = new (winston.Logger)({ transports : [new (winston.transports.Console)({ json : false, timestamp : true, colorize: true }), new winston.transports.File({ filename : __dirname + '/debug.log', json : true })] ,exitOnError : false }); // **help me to add line number** var logger_info_old = winston.info; logger.info = function(msg) { […]

8小时后,Nodemailer再次发送邮件

当用户使用以下函数请求新密码时,我正在使用nodemailer模块从节点服务器发送邮件: function(email, password, callback) { var smtpTransport = nodemailer.createTransport('SMTP', { service: 'Gmail', auth: { user: 'something@gmail.com', pass: 'my_password' } }); var mailOptions = { from: 'My Team<something@gmail.com>', to: email, subject: 'new password', text: 'login with email: ' + email + 'and password: ' + password, html: '<p>login with email: ' + email + ' and […]

处理“未捕获的exception”仍然以某种方式崩溃的应用程序

寻找关于如何debugging应用程序的随机崩溃而不被以下事件捕获的想法: process.on('uncaughtException', function(err){}); 我也没有尝试Winston(日志文件保持空)来捕捉导致应用程序崩溃的任何东西: winston.handleExceptions(new winston.transports.File({ filename: 'exceptions.log' })) 什么样的程序错误甚至可以通过这些?

如何使用s3-streamlogger节点模块重新logging日志文件中的内容并上传到s3中?

我正在使用winston节点模块( https://www.npmjs.com/package/winston )生成日志文件和s3-streamlogger模块( https://www.npmjs.com/package/s3-streamlogger )来保存它进入s3服务器。 var s3_stream = new S3StreamLogger({ bucket: bucket, access_key_id: accessKeyId, secret_access_key: secretAccessKey, name_format: "mylog.log" }); var logger = new(winston.Logger)({ transports: [ new (winston.transports.Console)(), new (winston.transports.File)({ stream: s3_stream }) ] }); function formatArgs(args){ return [util.format.apply(util.format, Array.prototype.slice.call(args))]; } console.log = function(){ logger.info.apply(logger, formatArgs(arguments)); }; 我的问题是,每次服务器重新启动时日志文件都会更新。 我希望以前的日志应该是他们的日志文件和新的日志应附加在那。 但是这没有发生。 我尝试了很多东西,但没有为我工作。 谁能帮我?

将不同的格式化程序添加到Winston传输

我需要为每个传输不同types的格式化程序。 例 logger = new (winston.Logger)({ transports: [ new (winston.transports.LogstashUDP)({ // some config here. Do noting on formatting }), new (winston.transports.Mail)({ // do formatting one way }), new (winston.transports.File)({ // write to file as json (maybe format it here) }), new (winston.transports.Console)({ // do another formatting }) ] }); 正如我从winston传输文档只能看到控制台支持自定义格式化程序。 我使用winston-logstash-upd winston-mailer模块来发送邮件和winston-logstash-upd 温斯顿有什么办法解决这个问题吗? 或者,也许如何创build这些模块之一的包装来支持格式?

如何在winstonlogging器中创build一个文件

我目前使用温斯顿logging器我有一个有没有任何温斯顿logging器function,这有助于创build日志文件,如果当前文件不存在logging? winston.loggers.add("order_log", { transports: [ new(winston.transports.Console)({ //name: "order_check_console", level: 'debug', //json: true, colorize: true }), new(winston.transports.File)({ //name: "order_check_file", filename: system_path.order_trans_path, level: 'debug', handleExceptions: true, humanReadableUnhandledException: true }) ] });

Winston与HAPI日志logging不起作用

我有一个启用Winston日志的项目,该项目使用HAPI。 我有以下代码: logger.js ——— var winston = require('winston'); winston.emitErrs = true; var logger = new winston.Logger({ transports: [ new winston.transports.Console({ level: 'debug', json: false, colorize: true }) ], exitOnError: false }); module.exports = logger; module.exports.stream = { write: function(message, encoding){ logger.info(message); } }; server.js ——— var Hapi = require('hapi'); var logger = require('./conf/logger.js'); var server […]

用bunyan捕捉exception

我正在使用bunyan来logging我的node.js代码。 但是我想知道有没有像winston的ExceptionHandlers:[] bunyan?

即使winstonlogging器exitOnError设置为false,节点进程仍然退出

这是我的winstonlogging器configuration。 我有exitOnError设置为false,但无论如何节点进程退出错误。 有没有其他的select? 我也有process.on('uncaughtException', function(err) {}定义,这曾经工作之前,我把winstonlogging器添加到混合 – var papertrailConfig = { humanReadableUnhandledException: true, enabled: true, level: 'info', host: 'logs4.papertrailapp.com', port: 10308, program: serviceName }; // define transports var logTransports = []; var paperTrailTransport = new winston.transports.Papertrail(papertrailConfig); paperTrailTransport.exceptionsLevel = 'info'; paperTrailTransport.colorize = true; var fileName = process.argv[2] || 'general'; // production gets file and paperTrailTransport logTransports.push( […]