mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-09 13:36:14 +00:00
move logger api call into logger
This commit is contained in:
parent
e36dd40ca1
commit
7868a72f3b
@ -11,8 +11,23 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -36,12 +36,6 @@ class Server {
|
||||
|
||||
expressWebSocket(app);
|
||||
|
||||
app.ws('/embark/logs', function(ws, req) {
|
||||
self.events.on("log", function(logLevel, logMsg) {
|
||||
ws.send(JSON.stringify({msg: logMsg, msg_clear: logMsg.stripColors, logLevel: logLevel}), () => {});
|
||||
});
|
||||
});
|
||||
|
||||
let apiCalls = self.plugins.getPluginsProperty("apiCalls", "apiCalls");
|
||||
for (let apiCall of apiCalls) {
|
||||
app[apiCall.method].apply(app, [apiCall.endpoint, apiCall.cb]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user