refactor: Replace console logging with logger utility
- Add logger import across multiple view components - Replace console.error/warn/log with logger methods - Update error handling to use structured logging - Improve type safety for error objects - Add crypto-browserify polyfill for browser environment The changes improve logging by: 1. Using consistent logging interface 2. Adding structured error logging 3. Improving error type safety 4. Centralizing logging configuration 5. Fixing browser compatibility issues Affected files: - Multiple view components - vite.config.ts - Build configuration
This commit is contained in:
@@ -164,7 +164,7 @@ import {
|
||||
createAndSubmitGive,
|
||||
getHeaders,
|
||||
} from "../libs/endorserServer";
|
||||
|
||||
import { logger } from "../utils/logger";
|
||||
@Component({
|
||||
methods: { claimSpecialDescription },
|
||||
components: {
|
||||
@@ -229,7 +229,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("Bad response", response);
|
||||
logger.error("Bad response", response);
|
||||
throw new Error("Bad response when retrieving claims.");
|
||||
}
|
||||
await response.json().then((data) => {
|
||||
@@ -248,7 +248,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
dataByOthers.length - dataByOthersWithoutHidden.length;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
logger.error("Error:", error);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -300,7 +300,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
result.status === "fulfilled" && result.value.type === "success",
|
||||
);
|
||||
if (confirmsSucceeded.length < this.claimsToConfirmSelected.length) {
|
||||
console.error("Error sending confirmations:", confirmResults);
|
||||
logger.error("Error sending confirmations:", confirmResults);
|
||||
const howMany = confirmsSucceeded.length === 0 ? "all" : "some";
|
||||
this.$notify(
|
||||
{
|
||||
@@ -333,7 +333,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
);
|
||||
giveSucceeded = giveResult.type === "success";
|
||||
if (!giveSucceeded) {
|
||||
console.error("Error sending give:", giveResult);
|
||||
logger.error("Error sending give:", giveResult);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -405,7 +405,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
console.error("Error sending claims.", error);
|
||||
logger.error("Error sending claims.", error);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
|
||||
Reference in New Issue
Block a user