diff --git a/lib/core/logger.js b/lib/core/logger.js index 8aa02fe2..149d1eb9 100644 --- a/lib/core/logger.js +++ b/lib/core/logger.js @@ -19,8 +19,23 @@ Logger.logLevels = { trace: 'trace' }; -Logger.prototype.writeToFile = function () { - if (!this.logFile) { +Logger.prototype.registerAPICall = function (plugins) { + 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; }