Skip to content

Commit

Permalink
Improved: logger usage in place of console
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Jan 16, 2024
1 parent 0744579 commit 8c0c18b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/components/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import { IonSkeletonText } from '@ionic/vue'
import logger from "@/logger";
export default defineComponent({
name: "Image",
Expand Down Expand Up @@ -54,15 +55,15 @@ export default defineComponent({
this.imageUrl = this.src;
}).catch(() => {
this.imageUrl = require("@/assets/images/defaultImage.png") ;
console.error("Image doesn't exist");
logger.error("Image doesn't exist");
})
} else {
// Image is from resource server, hence append to base resource url, check for existence and assign
const imageUrl = this.resourceUrl.concat(this.src)
this.checkIfImageExists(imageUrl).then(() => {
this.imageUrl = imageUrl;
}).catch(() => {
console.error("Image doesn't exist");
logger.error("Image doesn't exist");
})
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/store/modules/orderRouting/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import OrderRoutingState from "./OrderRoutingState"
import { OrderRoutingService } from "@/services/RoutingService"
import { hasError, showToast, sortSequence } from "@/utils"
import * as types from './mutation-types'
import logger from "@/logger"

const actions: ActionTree<OrderRoutingState, RootState> = {
async fetchOrderRoutingGroups({ commit }) {
Expand All @@ -20,7 +21,7 @@ const actions: ActionTree<OrderRoutingState, RootState> = {
throw resp.data
}
} catch(err) {
console.log(err);
logger.error(err);
}

if(routingGroups.length) {
Expand All @@ -44,7 +45,7 @@ const actions: ActionTree<OrderRoutingState, RootState> = {
}
} catch(err) {
showToast("Failed to create brokering run")
console.log('err', err)
logger.error('err', err)
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import UserState from "./UserState"
import * as types from "./mutation-types"
import { hasError, showToast } from "@/utils"
import { translate } from "@/i18n"
import logger from "@/logger"

const actions: ActionTree<UserState, RootState> = {

Expand All @@ -23,17 +24,17 @@ const actions: ActionTree<UserState, RootState> = {
return resp.data;
} else if (hasError(resp)) {
showToast(translate("Sorry, your username or password is incorrect. Please try again."));
console.error("error", resp.data._ERROR_MESSAGE_);
logger.error("error", resp.data._ERROR_MESSAGE_);
return Promise.reject(new Error(resp.data._ERROR_MESSAGE_));
}
} else {
showToast(translate("Something went wrong"));
console.error("error", resp.data._ERROR_MESSAGE_);
logger.error("error", resp.data._ERROR_MESSAGE_);
return Promise.reject(new Error(resp.data._ERROR_MESSAGE_));
}
} catch (err: any) {
showToast(translate("Something went wrong"));
console.error("error", err);
logger.error("error", err);
return Promise.reject(new Error(err))
}
},
Expand Down

0 comments on commit 8c0c18b

Please sign in to comment.