forked from trent_larson/crowd-funder-for-time-pwa
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:
@@ -159,7 +159,8 @@
|
||||
>
|
||||
<!--
|
||||
There's no need for a green icon:
|
||||
it's unnecessary if there's already a green, and confusing if there's a yellow.
|
||||
it's unnecessary if there's already a green, and confusing if there's a
|
||||
yellow.
|
||||
-->
|
||||
all
|
||||
</span>
|
||||
@@ -287,7 +288,7 @@ import {
|
||||
} from "../libs/endorserServer";
|
||||
import * as libsUtil from "../libs/util";
|
||||
import { OnboardPage } from "../libs/util";
|
||||
|
||||
import { logger } from "../utils/logger";
|
||||
@Component({
|
||||
components: {
|
||||
EntityIcon,
|
||||
@@ -345,13 +346,13 @@ export default class ProjectsView extends Vue {
|
||||
}
|
||||
|
||||
if (this.allMyDids.length === 0) {
|
||||
console.error("No accounts found.");
|
||||
logger.error("No accounts found.");
|
||||
this.errNote("You need an identifier to load your projects.");
|
||||
} else {
|
||||
await this.loadProjects();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error initializing:", err);
|
||||
logger.error("Error initializing:", err);
|
||||
this.errNote("Something went wrong loading your projects.");
|
||||
}
|
||||
}
|
||||
@@ -380,7 +381,7 @@ export default class ProjectsView extends Vue {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Bad server response & data for plans:",
|
||||
resp.status,
|
||||
resp.data,
|
||||
@@ -389,7 +390,7 @@ export default class ProjectsView extends Vue {
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
console.error("Got error loading plans:", error.message || error);
|
||||
logger.error("Got error loading plans:", error.message || error);
|
||||
this.errNote("Got an error loading projects.");
|
||||
} finally {
|
||||
this.isLoading = false;
|
||||
@@ -473,7 +474,7 @@ export default class ProjectsView extends Vue {
|
||||
this.offers = this.offers.concat([offer]);
|
||||
}
|
||||
} else {
|
||||
console.error(
|
||||
logger.error(
|
||||
"Bad server response & data for offers:",
|
||||
resp.status,
|
||||
resp.data,
|
||||
@@ -490,7 +491,7 @@ export default class ProjectsView extends Vue {
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
console.error("Got error loading offers:", error.message || error);
|
||||
logger.error("Got error loading offers:", error.message || error);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
|
||||
Reference in New Issue
Block a user