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

Changed levels of WS logs

This commit is contained in:
Maciej Lenartowicz 2019-12-17 17:45:55 +01:00
parent 3f87e9e4b4
commit 3d290114fa
No known key found for this signature in database
GPG Key ID: 1ABD2CB41B59B8E4

View File

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