nodejs console输出到文件
2021-08-06 04:56
标签:ram lin create rip err att param javascrip java var fs = require(‘fs‘) var util = require(‘util‘) var logPath = ‘upgrade.log‘ var logFile = fs.createWriteStream(logPath, { flags: ‘a‘ }) console.log = function() { logFile.write(util.format.apply(null, arguments) + ‘\n‘) process.stdout.write(util.format.apply(null, arguments) + ‘\n‘) } console.error = function() { logFile.write(util.format.apply(null, arguments) + ‘\n‘) process.stderr.write(util.format.apply(null, arguments) + ‘\n‘) }nodejs console输出到文件标签:ram lin create rip err att param javascrip java 原文地址:https://www.cnblogs.com/youxin/p/14889043.html
上一篇:多线程 之锁
文章标题:nodejs console输出到文件
文章链接:http://soscw.com/index.php/essay/107262.html