move logger api call into logger

This commit is contained in:
Iuri Matias 2018-03-13 06:57:02 -04:00 committed by Pascal Precht
parent 9ed4922367
commit 6c88ebd874
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 17 additions and 2 deletions

View File

@ -19,8 +19,23 @@ Logger.logLevels = {
trace: 'trace' trace: 'trace'
}; };
Logger.prototype.writeToFile = function () { Logger.prototype.registerAPICall = function (plugins) {
if (!this.logFile) { const self = this;
let plugin = plugins.createPlugin('dashboard', {});
plugin.registerAPICall(
'ws',
'/embark/logs',
(ws, req) => {
self.events.on("log", function(logLevel, logMsg) {
ws.send(JSON.stringify({msg: logMsg, msg_clear: logMsg.stripColors, logLevel: logLevel}), () => {});
});
}
);
};
Logger.prototype.writeToFile = function (txt) {
if (!this.logfile) {
return; return;
} }