mirror of https://github.com/embarklabs/embark.git
move logger api call into logger
This commit is contained in:
parent
9ed4922367
commit
6c88ebd874
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue