make taskworker console.* log to file and not stdout
this is similar to code in box.js
This commit is contained in:
@@ -43,15 +43,10 @@ const taskId = process.argv[2];
|
||||
const logFile = process.argv[3];
|
||||
|
||||
function setupLogging(callback) {
|
||||
fs.open(logFile, 'a', function (error, fd) {
|
||||
if (error) return callback(error);
|
||||
const logfileStream = fs.createWriteStream(logFile, { flags:'a' });
|
||||
process.stdout.write = process.stderr.write = logfileStream.write.bind(logfileStream);
|
||||
|
||||
require('debug').log = function (...args) {
|
||||
fs.appendFileSync(fd, util.format(...args) + '\n');
|
||||
};
|
||||
|
||||
callback();
|
||||
});
|
||||
callback();
|
||||
}
|
||||
|
||||
// Main process starts here
|
||||
|
||||
Reference in New Issue
Block a user