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:
Matthew Raymer
2025-03-11 09:35:55 +00:00
parent 8cae601148
commit e0aded04b4
1911 changed files with 88846 additions and 401 deletions

View File

@@ -275,7 +275,9 @@
</div>
</div>
<!-- Note that a similar section is found in ClaimView.vue, and kinda in HiddenDidDialog.vue -->
<!--
Note that a similar section is found in ClaimView.vue, and kinda in HiddenDidDialog.vue
-->
<h2
class="font-bold uppercase text-xl text-blue-500 mt-8 cursor-pointer"
@click="showVeriClaimDump = !showVeriClaimDump"
@@ -445,7 +447,7 @@ import { displayAmount } from "../libs/endorserServer";
import * as libsUtil from "../libs/util";
import { retrieveAccountDids } from "../libs/util";
import TopMessage from "../components/TopMessage.vue";
import { logger } from "../utils/logger";
/**
* ConfirmGiftView Component
*
@@ -515,7 +517,7 @@ export default class ConfirmGiftView extends Vue {
await this.initializeSettings();
await this.loadClaimFromUrl();
} catch (error) {
console.error("Error in mounted:", error);
logger.error("Error in mounted:", error);
this.handleMountError(error);
} finally {
this.isLoading = false;
@@ -610,7 +612,7 @@ export default class ConfirmGiftView extends Vue {
throw new Error("Error getting claim: " + resp.status);
}
} catch (error) {
console.error("Error getting claim:", error);
logger.error("Error getting claim:", error);
throw new Error("There was a problem retrieving that claim.");
}
}
@@ -631,7 +633,7 @@ export default class ConfirmGiftView extends Vue {
throw new Error("Error getting detailed give info: " + resp.status);
}
} catch (error) {
console.error("Error getting detailed give info:", error);
logger.error("Error getting detailed give info:", error);
throw new Error("Something went wrong retrieving gift data.");
}
}