Web: remove console.log calls

Remove a whole lot of `console.log()` calls. They were useful during
development, but not really suitable for production environments. Because
they also include (potentially large) objects, they can even slow down
the webapp itself.
This commit is contained in:
Sybren A. Stüvel 2022-08-01 17:11:45 +02:00
parent e6b662b8cd
commit 37477fc6bd
9 changed files with 4 additions and 27 deletions

View File

@ -71,7 +71,7 @@ export default {
connectToWebsocket() { connectToWebsocket() {
// The SocketIO client API docs are available at: // The SocketIO client API docs are available at:
// https://github.com/socketio/socket.io-client/blob/2.4.x/docs/API.md // https://github.com/socketio/socket.io-client/blob/2.4.x/docs/API.md
console.log("connecting JobsListener to WS", websocketURL); // console.log("connecting JobsListener to WS", websocketURL);
const ws = io(websocketURL, { const ws = io(websocketURL, {
transports: ["websocket"], transports: ["websocket"],
}); });
@ -83,7 +83,7 @@ export default {
window.ws = ws; window.ws = ws;
this.socket.on('connect', (error) => { this.socket.on('connect', (error) => {
console.log("socketIO connection established"); // console.log("socketIO connection established");
this.sockStatus.connected(); this.sockStatus.connected();
this._resubscribe(); this._resubscribe();
}); });
@ -102,7 +102,7 @@ export default {
}); });
this.socket.on("disconnect", (reason) => { this.socket.on("disconnect", (reason) => {
console.log("socketIO disconnected:", reason); // console.log("socketIO disconnected:", reason);
this.$emit("sioDisconnected", reason); this.$emit("sioDisconnected", reason);
this.sockStatus.disconnected(reason); this.sockStatus.disconnected(reason);
@ -179,7 +179,6 @@ export default {
sendBroadcastMessage(name, message) { sendBroadcastMessage(name, message) {
const payload = { name: name, text: message }; const payload = { name: name, text: message };
console.log("sending broadcast message:", payload);
this.socket.emit("/chat", payload); this.socket.emit("/chat", payload);
}, },
@ -190,7 +189,6 @@ export default {
*/ */
_updateMainSubscription(operation, type) { _updateMainSubscription(operation, type) {
const payload = new API.SocketIOSubscription(operation, type); const payload = new API.SocketIOSubscription(operation, type);
console.log(`sending ${type} ${operation}:`, payload);
this.socket.emit("/subscription", payload); this.socket.emit("/subscription", payload);
}, },
@ -202,7 +200,6 @@ export default {
_updateJobSubscription(operation, jobID) { _updateJobSubscription(operation, jobID) {
const payload = new API.SocketIOSubscription(operation, "job"); const payload = new API.SocketIOSubscription(operation, "job");
payload.uuid = jobID; payload.uuid = jobID;
console.log(`sending job ${operation}:`, payload);
this.socket.emit("/subscription", payload); this.socket.emit("/subscription", payload);
}, },
@ -214,7 +211,6 @@ export default {
_updateTaskLogSubscription(operation, taskID) { _updateTaskLogSubscription(operation, taskID) {
const payload = new API.SocketIOSubscription(operation, "tasklog"); const payload = new API.SocketIOSubscription(operation, "tasklog");
payload.uuid = taskID; payload.uuid = taskID;
console.log(`sending tasklog ${operation}:`, payload);
this.socket.emit("/subscription", payload); this.socket.emit("/subscription", payload);
}, },

View File

@ -33,8 +33,6 @@ onMounted(() => {
tabulator = new Tabulator('#task_log_list', tabOptions); tabulator = new Tabulator('#task_log_list', tabOptions);
tabulator.on("tableBuilt", _scrollToBottom); tabulator.on("tableBuilt", _scrollToBottom);
tabulator.on("tableBuilt", _subscribeToPinia); tabulator.on("tableBuilt", _subscribeToPinia);
console.log("Task log list: mounted on task ID", tasks.activeTaskID);
_fetchLogTail(tasks.activeTaskID); _fetchLogTail(tasks.activeTaskID);
}); });
onUnmounted(() => { onUnmounted(() => {
@ -42,7 +40,6 @@ onUnmounted(() => {
}); });
tasks.$subscribe((_, state) => { tasks.$subscribe((_, state) => {
console.log("Task log list: new task ID", state.activeTaskID);
_fetchLogTail(state.activeTaskID); _fetchLogTail(state.activeTaskID);
}); });

View File

@ -152,7 +152,6 @@ export default {
}, },
onJobTypeLoaded(jobType) { onJobTypeLoaded(jobType) {
console.log("Job type loaded: ", jobType);
this.jobType = jobType; this.jobType = jobType;
// Construct a lookup table for the settings. // Construct a lookup table for the settings.

View File

@ -48,14 +48,11 @@ function fetchImageURL(jobID) {
* @param {JobLastRenderedImageInfo} thumbnailInfo * @param {JobLastRenderedImageInfo} thumbnailInfo
*/ */
function setImageURL(thumbnailInfo) { function setImageURL(thumbnailInfo) {
console.log("LastRenderedImage.vue: setImageURL", thumbnailInfo);
if (thumbnailInfo == null) { if (thumbnailInfo == null) {
// This indicates that there is no last-rendered image. // This indicates that there is no last-rendered image.
// Default to a hard-coded 'nothing to be seen here, move along' image. // Default to a hard-coded 'nothing to be seen here, move along' image.
imageURL.value = "/app/nothing-rendered-yet.svg"; imageURL.value = "/app/nothing-rendered-yet.svg";
cssClasses['nothing-rendered-yet'] = true; cssClasses['nothing-rendered-yet'] = true;
console.log("LastRenderedImage.vue: setting image URL to:", imageURL.value);
return; return;
} }
@ -72,7 +69,6 @@ function setImageURL(thumbnailInfo) {
url.pathname = thumbnailInfo.base + "/" + suffix url.pathname = thumbnailInfo.base + "/" + suffix
url.search = new Date().getTime(); // This forces the image to be reloaded. url.search = new Date().getTime(); // This forces the image to be reloaded.
imageURL.value = url.toString(); imageURL.value = url.toString();
console.log("LastRenderedImage.vue: setting image URL to:", imageURL.value);
foundThumbnail = true; foundThumbnail = true;
break; break;
} }
@ -95,13 +91,11 @@ function refreshLastRenderedImage(lastRenderedUpdate) {
return; return;
} }
console.log('refreshLastRenderedImage:', lastRenderedUpdate);
setImageURL(lastRenderedUpdate.thumbnail); setImageURL(lastRenderedUpdate.thumbnail);
} }
// Call fetchImageURL(jobID) whenever the job ID prop changes value. // Call fetchImageURL(jobID) whenever the job ID prop changes value.
watch(() => props.jobID, (newJobID) => { watch(() => props.jobID, (newJobID) => {
console.log("Last-Rendered Image: new job ID: ", newJobID);
fetchImageURL(newJobID); fetchImageURL(newJobID);
}); });
fetchImageURL(props.jobID); fetchImageURL(props.jobID);

View File

@ -130,7 +130,6 @@ export default {
this.fetchTasks(); this.fetchTasks();
}, },
fetchTasks() { fetchTasks() {
console.log("Fetching tasks for job", this.jobID);
if (!this.jobID) { if (!this.jobID) {
this.tabulator.setData([]); this.tabulator.setData([]);
return; return;

View File

@ -46,7 +46,6 @@ const apiClient = new ApiClient(urls.api());;
const metaAPI = new MetaApi(apiClient); const metaAPI = new MetaApi(apiClient);
metaAPI.getConfiguration() metaAPI.getConfiguration()
.then((config) => { .then((config) => {
console.log("Got config!", config);
if (config.isFirstRun) setupAssistantMode(); if (config.isFirstRun) setupAssistantMode();
else normalMode(); else normalMode();
}) })

View File

@ -34,7 +34,6 @@ export const useNotifs = defineStore('notifications', {
const notif = {id: this._generateID(), msg: message, time: new Date()}; const notif = {id: this._generateID(), msg: message, time: new Date()};
this.history.push(notif); this.history.push(notif);
this.last = notif; this.last = notif;
console.log("New notification:", plain(notif));
this._prune(); this._prune();
this._restartHideTimer(); this._restartHideTimer();
}, },
@ -43,7 +42,6 @@ export const useNotifs = defineStore('notifications', {
* @param {API.SocketIOJobUpdate} jobUpdate Job update received via SocketIO. * @param {API.SocketIOJobUpdate} jobUpdate Job update received via SocketIO.
*/ */
addJobUpdate(jobUpdate) { addJobUpdate(jobUpdate) {
console.log('Received job update:', jobUpdate);
let msg = `Job ${jobUpdate.name}`; let msg = `Job ${jobUpdate.name}`;
if (jobUpdate.previous_status && jobUpdate.previous_status != jobUpdate.status) { if (jobUpdate.previous_status && jobUpdate.previous_status != jobUpdate.status) {
msg += ` changed status ${jobUpdate.previous_status}${jobUpdate.status}`; msg += ` changed status ${jobUpdate.previous_status}${jobUpdate.status}`;
@ -55,7 +53,6 @@ export const useNotifs = defineStore('notifications', {
* @param {API.SocketIOTaskUpdate} taskUpdate Task update received via SocketIO. * @param {API.SocketIOTaskUpdate} taskUpdate Task update received via SocketIO.
*/ */
addTaskUpdate(taskUpdate) { addTaskUpdate(taskUpdate) {
console.log('Received task update:', taskUpdate);
let msg = `Task ${taskUpdate.name}`; let msg = `Task ${taskUpdate.name}`;
if (taskUpdate.previous_status && taskUpdate.previous_status != taskUpdate.status) { if (taskUpdate.previous_status && taskUpdate.previous_status != taskUpdate.status) {
msg += ` changed status ${taskUpdate.previous_status}${taskUpdate.status}`; msg += ` changed status ${taskUpdate.previous_status}${taskUpdate.status}`;
@ -70,7 +67,6 @@ export const useNotifs = defineStore('notifications', {
* @param {API.SocketIOWorkerUpdate} workerUpdate Worker update received via SocketIO. * @param {API.SocketIOWorkerUpdate} workerUpdate Worker update received via SocketIO.
*/ */
addWorkerUpdate(workerUpdate) { addWorkerUpdate(workerUpdate) {
console.log('Received worker update:', workerUpdate);
let msg = `Worker ${workerUpdate.name}`; let msg = `Worker ${workerUpdate.name}`;
if (workerUpdate.previous_status && workerUpdate.previous_status != workerUpdate.status) { if (workerUpdate.previous_status && workerUpdate.previous_status != workerUpdate.status) {
msg += ` changed status ${workerUpdate.previous_status}${workerUpdate.status}`; msg += ` changed status ${workerUpdate.previous_status}${workerUpdate.status}`;

View File

@ -182,7 +182,6 @@ export default {
*/ */
_routeToJob(jobID) { _routeToJob(jobID) {
const route = { name: 'jobs', params: { jobID: jobID } }; const route = { name: 'jobs', params: { jobID: jobID } };
console.log("routing to job", route.params);
this.$router.push(route); this.$router.push(route);
}, },
/** /**
@ -191,7 +190,6 @@ export default {
*/ */
_routeToTask(taskID) { _routeToTask(taskID) {
const route = { name: 'jobs', params: { jobID: this.jobID, taskID: taskID } }; const route = { name: 'jobs', params: { jobID: this.jobID, taskID: taskID } };
console.log("routing to task", route.params);
this.$router.push(route); this.$router.push(route);
}, },

View File

@ -91,7 +91,6 @@ export default {
*/ */
_routeToWorker(workerID) { _routeToWorker(workerID) {
const route = { name: 'workers', params: { workerID: workerID } }; const route = { name: 'workers', params: { workerID: workerID } };
console.log("routing to worker", route.params);
this.$router.push(route); this.$router.push(route);
}, },