mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-18 10:16:30 +00:00
Remove default behavior of logging to file
Default behavior of logging to file is no longer needed now that Embark log history can be properly served using the `ProcessLogsApi` and `LogHandler` classes. # Conflicts: # lib/core/logger.js # lib/modules/blockchain_process/blockchain.js
This commit is contained in:
parent
f5c77b1416
commit
9a830c3423
@ -14,13 +14,6 @@ class Logger {
|
|||||||
this.logFunction = options.logFunction || console.log;
|
this.logFunction = options.logFunction || console.log;
|
||||||
this.logFile = options.logFile;
|
this.logFile = options.logFile;
|
||||||
this.context = options.context;
|
this.context = options.context;
|
||||||
// Use a default logFile if none is specified in the cli,
|
|
||||||
// in the format .embark/logs/embark_<context>.log.
|
|
||||||
if (!this.logFile) {
|
|
||||||
this.logFile = fs.dappPath(`${constants.logs.logPath}embark_${this.context}.log`);
|
|
||||||
// creates log dir if it doesn't exist, and overwrites existing log file if it exists
|
|
||||||
fs.outputFileSync(this.logFile, '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,6 +79,9 @@ Logger.prototype.registerAPICall = function (plugins) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Logger.prototype.writeToFile = function (_txt) {
|
Logger.prototype.writeToFile = function (_txt) {
|
||||||
|
if (!this.logFile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const formattedDate = [`[${date.format(new Date(), DATE_FORMAT)}]`]; // adds a timestamp to the logs in the logFile
|
const formattedDate = [`[${date.format(new Date(), DATE_FORMAT)}]`]; // adds a timestamp to the logs in the logFile
|
||||||
fs.appendFileSync(this.logFile, "\n" + formattedDate.concat(Array.from(arguments)).join(' '));
|
fs.appendFileSync(this.logFile, "\n" + formattedDate.concat(Array.from(arguments)).join(' '));
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@ var Blockchain = function(userConfig, clientClass) {
|
|||||||
this.isDev = userConfig.isDev;
|
this.isDev = userConfig.isDev;
|
||||||
this.onReadyCallback = userConfig.onReadyCallback || (() => {});
|
this.onReadyCallback = userConfig.onReadyCallback || (() => {});
|
||||||
this.onExitCallback = userConfig.onExitCallback;
|
this.onExitCallback = userConfig.onExitCallback;
|
||||||
this.logger = userConfig.logger || new Logger({logLevel: 'debug'});
|
this.logger = userConfig.logger || new Logger({logLevel: 'debug', context: constants.contexts.blockchain}); // do not pass in events as we don't want any log events emitted
|
||||||
this.events = userConfig.events;
|
this.events = userConfig.events;
|
||||||
this.proxyIpc = null;
|
this.proxyIpc = null;
|
||||||
this.isStandalone = userConfig.isStandalone;
|
this.isStandalone = userConfig.isStandalone;
|
||||||
@ -222,7 +222,7 @@ Blockchain.prototype.run = function () {
|
|||||||
// TOCHECK I don't understand why stderr and stdout are reverted.
|
// TOCHECK I don't understand why stderr and stdout are reverted.
|
||||||
// This happens with Geth and Parity, so it does not seems a client problem
|
// This happens with Geth and Parity, so it does not seems a client problem
|
||||||
self.child.stdout.on('data', (data) => {
|
self.child.stdout.on('data', (data) => {
|
||||||
this.logger.info(`${self.client.name} error: ${data}`);
|
self.logger.info(`${self.client.name} error: ${data}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.child.stderr.on('data', async (data) => {
|
self.child.stderr.on('data', async (data) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user