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 Flag from "@/components/UI/Flag.vue";
|
||||||
import {useDebounceFn} from "@vueuse/core";
|
import {useDebounceFn} from "@vueuse/core";
|
||||||
import BasicBadge from "@/components/UI/BasicBadge.vue";
|
import BasicBadge from "@/components/UI/BasicBadge.vue";
|
||||||
|
import logger from "@/logger.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AutosuggestSearchbar',
|
name: 'AutosuggestSearchbar',
|
||||||
|
|
@ -182,7 +183,7 @@ export default {
|
||||||
this.highlightedIndex = -1
|
this.highlightedIndex = -1
|
||||||
this.$emit('suggestions-loaded', this.suggestions)
|
this.$emit('suggestions-loaded', this.suggestions)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching suggestions:', error)
|
logger.error('Error fetching suggestions:', error)
|
||||||
this.suggestions = []
|
this.suggestions = []
|
||||||
this.hideSuggestions()
|
this.hideSuggestions()
|
||||||
this.$emit('error', error)
|
this.$emit('error', error)
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,6 @@ export default {
|
||||||
},
|
},
|
||||||
handleClickOutside(event) {
|
handleClickOutside(event) {
|
||||||
|
|
||||||
console.log("HANDLE click outside")
|
|
||||||
|
|
||||||
if (!this.$refs.dropdown?.contains(event.target)) {
|
if (!this.$refs.dropdown?.contains(event.target)) {
|
||||||
this.closeDropdown()
|
this.closeDropdown()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ import {usePremiseEditStore} from "@/store/premiseEdit.js";
|
||||||
import {toRaw} from "vue";
|
import {toRaw} from "vue";
|
||||||
import DestinationMassRouteRow from "@/components/layout/edit/destination/mass/DestinationMassRouteRow.vue";
|
import DestinationMassRouteRow from "@/components/layout/edit/destination/mass/DestinationMassRouteRow.vue";
|
||||||
import Flag from "@/components/UI/Flag.vue";
|
import Flag from "@/components/UI/Flag.vue";
|
||||||
|
import logger from "@/logger.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DestinationMassRoute",
|
name: "DestinationMassRoute",
|
||||||
|
|
@ -234,7 +235,7 @@ export default {
|
||||||
existingDest.disabled = false;
|
existingDest.disabled = false;
|
||||||
|
|
||||||
if(existingDest.ids.includes(curDestOfPremise.id))
|
if(existingDest.ids.includes(curDestOfPremise.id))
|
||||||
console.log("Duplicate id: ", curDestOfPremise.id);
|
logger.log("Duplicate id: ", curDestOfPremise.id);
|
||||||
|
|
||||||
existingDest.ids.push(curDestOfPremise.id);
|
existingDest.ids.push(curDestOfPremise.id);
|
||||||
|
|
||||||
|
|
@ -248,7 +249,7 @@ export default {
|
||||||
const premiseRoutes = premiseDest.routes;
|
const premiseRoutes = premiseDest.routes;
|
||||||
|
|
||||||
if (rowDest.routes.length !== premiseRoutes.length) {
|
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;
|
rowDest.valid = false;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +260,7 @@ export default {
|
||||||
const rowRoute = rowDest.routes.find(r => r.routeCompareString === routeString && r.type === route.type);
|
const rowRoute = rowDest.routes.find(r => r.routeCompareString === routeString && r.type === route.type);
|
||||||
|
|
||||||
if (!rowRoute) {
|
if (!rowRoute) {
|
||||||
console.log("no matching route ", routeString, rowDest);
|
logger.log("no matching route ", routeString, rowDest);
|
||||||
rowDest.valid = false;
|
rowDest.valid = false;
|
||||||
} else {
|
} else {
|
||||||
rowRoute.ids.push(route.id);
|
rowRoute.ids.push(route.id);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
log.setLevel('debug') //TODO change back to 'silent'
|
log.setLevel('silent')
|
||||||
} else {
|
} else {
|
||||||
log.setLevel('debug')
|
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 DestMassCreate from "@/components/layout/edit/destination/mass/DestMassCreate.vue";
|
||||||
import ModalDialog from "@/components/UI/ModalDialog.vue";
|
import ModalDialog from "@/components/UI/ModalDialog.vue";
|
||||||
import destinationEdit from "@/components/layout/edit/destination/DestinationEdit.vue";
|
import destinationEdit from "@/components/layout/edit/destination/DestinationEdit.vue";
|
||||||
|
import logger from "@/logger.js";
|
||||||
|
|
||||||
|
|
||||||
const COMPONENT_TYPES = {
|
const COMPONENT_TYPES = {
|
||||||
|
|
@ -410,7 +411,7 @@ export default {
|
||||||
|
|
||||||
openModal(type, ids, dataSource = -1, massEdit = true) {
|
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) {
|
if ((type === 'amount' || type === 'routes') && this.modalStash === null) {
|
||||||
|
|
||||||
|
|
@ -430,7 +431,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.modalDialogShow) {
|
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.fillData(type, dataSource, massEdit);
|
||||||
this.editIds = ids;
|
this.editIds = ids;
|
||||||
this.modalType = type;
|
this.modalType = type;
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ export const useNotificationStore = defineStore('notification', {
|
||||||
this.stopAutoSubmitTimer()
|
this.stopAutoSubmitTimer()
|
||||||
this.sendCache = [];
|
this.sendCache = [];
|
||||||
} else {
|
} else {
|
||||||
console.error("Error transmitting errors: " + url, params);
|
logger.error("Error transmitting errors: " + url, params);
|
||||||
console.error(response, await response?.text());
|
logger.error(response, await response?.text());
|
||||||
this.startAutoSubmitTimer();
|
this.startAutoSubmitTimer();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -137,7 +137,7 @@ export const useNotificationStore = defineStore('notification', {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('Failed to capture store state:', err);
|
logger.warn('Failed to capture store state:', err);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,6 @@ export const usePremiseEditStore = defineStore('premiseEdit', {
|
||||||
},
|
},
|
||||||
async batchUpdatePrice(ids, priceData) {
|
async batchUpdatePrice(ids, priceData) {
|
||||||
|
|
||||||
console.log("batchUpdatePrice", ids, priceData)
|
|
||||||
|
|
||||||
const updatedPremises = this.premisses.map(p => {
|
const updatedPremises = this.premisses.map(p => {
|
||||||
if (ids.includes(p.id)) {
|
if (ids.includes(p.id)) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -284,7 +282,7 @@ export const usePremiseEditStore = defineStore('premiseEdit', {
|
||||||
let success = true;
|
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;
|
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;
|
if (!toBeUpdated?.length) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue