1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'ws-logging' into 'dev'

Changed levels of WS logs

Closes reforis#162

See merge request turris/reforis/foris-js!61
This commit is contained in:
Maciej Lenartowicz 2019-12-19 11:58:59 +01:00
commit 4eae1ed8d2

View File

@ -25,18 +25,18 @@ export class WebSockets {
console.error("WS: Error observed, you aren't logged probably.");
window.location.replace(ForisURLs.login);
}
console.log(`WS: Error: ${e}`);
console.error(`WS: Error: ${e}`);
};
this.ws.onmessage = (e) => {
console.log(`WS: Received Message: ${e.data}`);
console.debug(`WS: Received Message: ${e.data}`);
const data = JSON.parse(e.data);
this.dispatch(data);
};
this.ws.onopen = () => {
console.log("WS: Connection open.");
console.debug("WS: Connection open.");
};
this.ws.onclose = () => {
console.log("WS: Connection closed.");
console.debug("WS: Connection closed.");
};
// callbacks[module][action]
@ -111,7 +111,7 @@ export class WebSockets {
chain = this.callbacks[json.module][json.action];
} catch (error) {
if (error instanceof TypeError) {
console.log(`Callback for this message wasn't found:${error.data}`);
console.warn(`Callback for this message wasn't found:${error.data}`);
} else throw error;
}