Replace all console statements with centralized logger for consistent logging across components and stores.
This commit is contained in:
parent
0fef090372
commit
2fcba02227
8 changed files with 15 additions and 16 deletions
|
|
@ -76,6 +76,7 @@ import Spinner from "@/components/UI/Spinner.vue";
|
|||
import Flag from "@/components/UI/Flag.vue";
|
||||
import {useDebounceFn} from "@vueuse/core";
|
||||
import BasicBadge from "@/components/UI/BasicBadge.vue";
|
||||
import logger from "@/logger.js";
|
||||
|
||||
export default {
|
||||
name: 'AutosuggestSearchbar',
|
||||
|
|
@ -182,7 +183,7 @@ export default {
|
|||
this.highlightedIndex = -1
|
||||
this.$emit('suggestions-loaded', this.suggestions)
|
||||
} catch (error) {
|
||||
console.error('Error fetching suggestions:', error)
|
||||
logger.error('Error fetching suggestions:', error)
|
||||
this.suggestions = []
|
||||
this.hideSuggestions()
|
||||
this.$emit('error', error)
|
||||
|
|
|
|||
|
|
@ -144,8 +144,6 @@ export default {
|
|||
},
|
||||
handleClickOutside(event) {
|
||||
|
||||
console.log("HANDLE click outside")
|
||||
|
||||
if (!this.$refs.dropdown?.contains(event.target)) {
|
||||
this.closeDropdown()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import {usePremiseEditStore} from "@/store/premiseEdit.js";
|
|||
import {toRaw} from "vue";
|
||||
import DestinationMassRouteRow from "@/components/layout/edit/destination/mass/DestinationMassRouteRow.vue";
|
||||
import Flag from "@/components/UI/Flag.vue";
|
||||
import logger from "@/logger.js";
|
||||
|
||||
export default {
|
||||
name: "DestinationMassRoute",
|
||||
|
|
@ -234,7 +235,7 @@ export default {
|
|||
existingDest.disabled = false;
|
||||
|
||||
if(existingDest.ids.includes(curDestOfPremise.id))
|
||||
console.log("Duplicate id: ", curDestOfPremise.id);
|
||||
logger.log("Duplicate id: ", curDestOfPremise.id);
|
||||
|
||||
existingDest.ids.push(curDestOfPremise.id);
|
||||
|
||||
|
|
@ -248,7 +249,7 @@ export default {
|
|||
const premiseRoutes = premiseDest.routes;
|
||||
|
||||
if (rowDest.routes.length !== premiseRoutes.length) {
|
||||
console.log("length mismatch ", toRaw(rowDest), toRaw(premiseDest));
|
||||
logger.log("length mismatch ", toRaw(rowDest), toRaw(premiseDest));
|
||||
rowDest.valid = false;
|
||||
return
|
||||
}
|
||||
|
|
@ -259,7 +260,7 @@ export default {
|
|||
const rowRoute = rowDest.routes.find(r => r.routeCompareString === routeString && r.type === route.type);
|
||||
|
||||
if (!rowRoute) {
|
||||
console.log("no matching route ", routeString, rowDest);
|
||||
logger.log("no matching route ", routeString, rowDest);
|
||||
rowDest.valid = false;
|
||||
} else {
|
||||
rowRoute.ids.push(route.id);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import log from 'loglevel'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
log.setLevel('debug') //TODO change back to 'silent'
|
||||
log.setLevel('silent')
|
||||
} else {
|
||||
log.setLevel('debug')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ import DestinationMassEdit from "@/components/layout/edit/destination/mass/Desti
|
|||
import DestMassCreate from "@/components/layout/edit/destination/mass/DestMassCreate.vue";
|
||||
import ModalDialog from "@/components/UI/ModalDialog.vue";
|
||||
import destinationEdit from "@/components/layout/edit/destination/DestinationEdit.vue";
|
||||
import logger from "@/logger.js";
|
||||
|
||||
|
||||
const COMPONENT_TYPES = {
|
||||
|
|
@ -410,7 +411,7 @@ export default {
|
|||
|
||||
openModal(type, ids, dataSource = -1, massEdit = true) {
|
||||
|
||||
console.log("open modal", type, ids, dataSource, massEdit, this.modalStash, this.modalDialogShow)
|
||||
logger.log("open modal", type, ids, dataSource, massEdit, this.modalStash, this.modalDialogShow)
|
||||
|
||||
if ((type === 'amount' || type === 'routes') && this.modalStash === null) {
|
||||
|
||||
|
|
@ -430,7 +431,7 @@ export default {
|
|||
}
|
||||
|
||||
if (!this.modalDialogShow) {
|
||||
console.log("open modal (actual)", type, ids, dataSource, massEdit, this.modalStash, this.modalDialogShow)
|
||||
logger.log("open modal (actual)", type, ids, dataSource, massEdit, this.modalStash, this.modalDialogShow)
|
||||
this.fillData(type, dataSource, massEdit);
|
||||
this.editIds = ids;
|
||||
this.modalType = type;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ export const useDestinationEditStore = defineStore('destinationEdit', {
|
|||
}, 10));
|
||||
|
||||
const destinationMap = new Map();
|
||||
|
||||
|
||||
premiseIds.forEach(premiseId => {
|
||||
this.destinations.get(premiseId)?.forEach(toUpdate => {
|
||||
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ export const useNotificationStore = defineStore('notification', {
|
|||
this.stopAutoSubmitTimer()
|
||||
this.sendCache = [];
|
||||
} else {
|
||||
console.error("Error transmitting errors: " + url, params);
|
||||
console.error(response, await response?.text());
|
||||
logger.error("Error transmitting errors: " + url, params);
|
||||
logger.error(response, await response?.text());
|
||||
this.startAutoSubmitTimer();
|
||||
}
|
||||
},
|
||||
|
|
@ -137,7 +137,7 @@ export const useNotificationStore = defineStore('notification', {
|
|||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to capture store state:', err);
|
||||
logger.warn('Failed to capture store state:', err);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,8 +219,6 @@ export const usePremiseEditStore = defineStore('premiseEdit', {
|
|||
},
|
||||
async batchUpdatePrice(ids, priceData) {
|
||||
|
||||
console.log("batchUpdatePrice", ids, priceData)
|
||||
|
||||
const updatedPremises = this.premisses.map(p => {
|
||||
if (ids.includes(p.id)) {
|
||||
return {
|
||||
|
|
@ -284,7 +282,7 @@ export const usePremiseEditStore = defineStore('premiseEdit', {
|
|||
let success = true;
|
||||
const toBeUpdated = this.premisses ? (ids ? (ids.map(id => this.premisses.find(p => String(p.id) === String(id)))) : (this.selectedIds.map(id => this.premisses.find(p => String(p.id) === String(id))))) : null;
|
||||
|
||||
console.log("toBeUpdated", ids, toBeUpdated, priceData);
|
||||
|
||||
|
||||
if (!toBeUpdated?.length) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue