forked from jsnbuchanan/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:
@@ -83,7 +83,7 @@ import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||
import { MASTER_SETTINGS_KEY } from "../db/tables/settings";
|
||||
import { accessToken } from "../libs/crypto";
|
||||
import { base64ToBlob, SHARED_PHOTO_BASE64_KEY } from "../libs/util";
|
||||
|
||||
import { logger } from "../utils/logger";
|
||||
@Component({ components: { PhotoDialog, QuickNav } })
|
||||
export default class SharedPhotoView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
@@ -113,10 +113,10 @@ export default class SharedPhotoView extends Vue {
|
||||
|
||||
this.imageFileName = this.$route.query["fileName"] as string;
|
||||
} else {
|
||||
console.error("No appropriate image found in temp storage.", temp);
|
||||
logger.error("No appropriate image found in temp storage.", temp);
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
console.error("Got an error loading an identifier:", err);
|
||||
logger.error("Got an error loading an identifier:", err);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -191,7 +191,7 @@ export default class SharedPhotoView extends Vue {
|
||||
window.location.hostname === "localhost" &&
|
||||
!DEFAULT_IMAGE_API_SERVER.includes("localhost")
|
||||
) {
|
||||
console.log(
|
||||
logger.log(
|
||||
"Using shared image API server, so only users on that server can play with images.",
|
||||
);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export default class SharedPhotoView extends Vue {
|
||||
this.imageFileName = undefined;
|
||||
result = response.data.url as string;
|
||||
} else {
|
||||
console.error("Problem uploading the image", response.data);
|
||||
logger.error("Problem uploading the image", response.data);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -221,7 +221,7 @@ export default class SharedPhotoView extends Vue {
|
||||
|
||||
this.uploading = false;
|
||||
} catch (error) {
|
||||
console.error("Error uploading the image", error);
|
||||
logger.error("Error uploading the image", error);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
|
||||
Reference in New Issue
Block a user