mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 19:02:28 +00:00
Revert "Refactor logging to centralized logger"
This commit is contained in:
1 parent
2e7038e0e6
commit
d705cf176b
67 files changed
+798
-1130
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import { devLogger, userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
isDevMode,
|
||||
ADMIN_SUPER_NPUB as CONFIG_ADMIN_SUPER_NPUB,
|
||||
@@ -941,7 +940,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
this.profileHistoryRenderer = this.createWatchHistoryRenderer(config);
|
||||
} catch (error) {
|
||||
userLogger.error(
|
||||
console.error(
|
||||
"[profileModal] Failed to create watch history renderer:",
|
||||
error,
|
||||
);
|
||||
@@ -1373,7 +1372,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
await this.switchProfile(entry.pubkey, { entry });
|
||||
} catch (error) {
|
||||
userLogger.error("Failed to switch profile:", error);
|
||||
console.error("Failed to switch profile:", error);
|
||||
} finally {
|
||||
button.dataset.loading = "false";
|
||||
button.setAttribute("aria-busy", "false");
|
||||
@@ -1428,7 +1427,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
this.profileHistoryRenderer?.pause();
|
||||
} catch (error) {
|
||||
userLogger.warn("[profileModal] Failed to pause history renderer:", error);
|
||||
console.warn("[profileModal] Failed to pause history renderer:", error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1991,7 +1990,7 @@ export class ProfileModalController {
|
||||
}
|
||||
this.populateBlockedList();
|
||||
} catch (error) {
|
||||
userLogger.error("Failed to add creator to personal block list:", error);
|
||||
console.error("Failed to add creator to personal block list:", error);
|
||||
context.error = error;
|
||||
context.reason = error?.code || "service-error";
|
||||
const message =
|
||||
@@ -2027,7 +2026,7 @@ export class ProfileModalController {
|
||||
}
|
||||
|
||||
if (!targetHex) {
|
||||
userLogger.warn("No valid pubkey to remove from block list:", candidate);
|
||||
console.warn("No valid pubkey to remove from block list:", candidate);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2056,7 +2055,7 @@ export class ProfileModalController {
|
||||
|
||||
this.populateBlockedList();
|
||||
} catch (error) {
|
||||
userLogger.error(
|
||||
console.error(
|
||||
"Failed to remove creator from personal block list:",
|
||||
error,
|
||||
);
|
||||
@@ -2112,7 +2111,7 @@ export class ProfileModalController {
|
||||
renderer.resume();
|
||||
}
|
||||
} catch (error) {
|
||||
userLogger.error(
|
||||
console.error(
|
||||
"[profileModal] Failed to populate watch history pane:",
|
||||
error,
|
||||
);
|
||||
@@ -2770,11 +2769,11 @@ export class ProfileModalController {
|
||||
|
||||
if (loadError) {
|
||||
if (loadError?.code === "nostr-unavailable") {
|
||||
devLogger.info("Moderation lists are still syncing with relays.");
|
||||
console.info("Moderation lists are still syncing with relays.");
|
||||
return;
|
||||
}
|
||||
|
||||
userLogger.error("Failed to load admin lists:", loadError);
|
||||
console.error("Failed to load admin lists:", loadError);
|
||||
this.showStatus(null);
|
||||
this.showError("Unable to load moderation lists. Please try again.");
|
||||
this.clearAdminLists();
|
||||
@@ -2867,7 +2866,7 @@ export class ProfileModalController {
|
||||
}
|
||||
} catch (error) {
|
||||
preloadError = error;
|
||||
userLogger.error("Failed to load admin lists before adding moderator:", error);
|
||||
console.error("Failed to load admin lists before adding moderator:", error);
|
||||
}
|
||||
|
||||
if (preloadError) {
|
||||
@@ -2971,7 +2970,7 @@ export class ProfileModalController {
|
||||
}
|
||||
} catch (error) {
|
||||
preloadError = error;
|
||||
userLogger.error("Failed to load admin lists before removing moderator:", error);
|
||||
console.error("Failed to load admin lists before removing moderator:", error);
|
||||
}
|
||||
|
||||
if (preloadError) {
|
||||
@@ -3078,7 +3077,7 @@ export class ProfileModalController {
|
||||
}
|
||||
} catch (error) {
|
||||
preloadError = error;
|
||||
userLogger.error("Failed to load admin lists before updating entries:", error);
|
||||
console.error("Failed to load admin lists before updating entries:", error);
|
||||
}
|
||||
|
||||
if (preloadError) {
|
||||
@@ -3163,7 +3162,7 @@ export class ProfileModalController {
|
||||
this.showError(errorMessage);
|
||||
}
|
||||
if (isDevMode && notifyResult?.error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[admin] Failed to send list notification DM:",
|
||||
notifyResult,
|
||||
);
|
||||
@@ -3179,9 +3178,9 @@ export class ProfileModalController {
|
||||
}
|
||||
} catch (error) {
|
||||
context.notificationError = error;
|
||||
userLogger.error("Failed to send list notification DM:", error);
|
||||
console.error("Failed to send list notification DM:", error);
|
||||
if (isDevMode) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"List update succeeded, but DM notification threw an unexpected error.",
|
||||
error,
|
||||
);
|
||||
@@ -3469,7 +3468,7 @@ export class ProfileModalController {
|
||||
targetHex,
|
||||
});
|
||||
} catch (refreshError) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[ProfileModalController] Failed to refresh videos after blocklist mutation:",
|
||||
refreshError,
|
||||
);
|
||||
@@ -3777,7 +3776,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
await this.refreshAdminPaneState();
|
||||
} catch (error) {
|
||||
userLogger.error(
|
||||
console.error(
|
||||
"Failed to refresh admin pane while opening profile modal:",
|
||||
error,
|
||||
);
|
||||
@@ -3794,7 +3793,7 @@ export class ProfileModalController {
|
||||
const activeHex = this.normalizeHexPubkey(this.getActivePubkey());
|
||||
await this.services.userBlocks.ensureLoaded(activeHex);
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"Failed to refresh user block list while opening profile modal:",
|
||||
error,
|
||||
);
|
||||
@@ -3887,7 +3886,7 @@ export class ProfileModalController {
|
||||
this.profileHistoryRenderer.destroy();
|
||||
}
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to reset watch history renderer on close:",
|
||||
error,
|
||||
);
|
||||
@@ -3914,7 +3913,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
previous.focus();
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to restore focus after closing modal:",
|
||||
error,
|
||||
);
|
||||
@@ -3927,7 +3926,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
this.callbacks.onClose(this);
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] onClose callback threw while hiding modal:",
|
||||
error,
|
||||
);
|
||||
@@ -3951,7 +3950,7 @@ export class ProfileModalController {
|
||||
persistActive: false,
|
||||
});
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to sync saved profiles during login:",
|
||||
error,
|
||||
);
|
||||
@@ -3971,7 +3970,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
await this.refreshAdminPaneState();
|
||||
} catch (error) {
|
||||
userLogger.warn("Failed to refresh admin pane after login:", error);
|
||||
console.warn("Failed to refresh admin pane after login:", error);
|
||||
}
|
||||
|
||||
this.populateBlockedList();
|
||||
@@ -3985,7 +3984,7 @@ export class ProfileModalController {
|
||||
this.refreshWalletPaneState();
|
||||
})
|
||||
.catch((error) => {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to hydrate deferred login data:",
|
||||
error,
|
||||
);
|
||||
@@ -4005,7 +4004,7 @@ export class ProfileModalController {
|
||||
persistActive: false,
|
||||
});
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to sync saved profiles during logout:",
|
||||
error,
|
||||
);
|
||||
@@ -4024,7 +4023,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
await this.refreshAdminPaneState();
|
||||
} catch (error) {
|
||||
userLogger.warn("Failed to refresh admin pane after logout:", error);
|
||||
console.warn("Failed to refresh admin pane after logout:", error);
|
||||
}
|
||||
|
||||
this.populateBlockedList();
|
||||
@@ -4042,7 +4041,7 @@ export class ProfileModalController {
|
||||
persistActive: false,
|
||||
});
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[profileModal] Failed to sync saved profiles after profile update:",
|
||||
error,
|
||||
);
|
||||
@@ -4067,7 +4066,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
result = this.services.removeSavedProfile(pubkey) || { removed: false };
|
||||
} catch (error) {
|
||||
userLogger.error("Failed to remove saved profile:", error);
|
||||
console.error("Failed to remove saved profile:", error);
|
||||
result = { removed: false, error };
|
||||
}
|
||||
|
||||
@@ -4100,7 +4099,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
return await hydrate(normalized);
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
`[ProfileModalController] Failed to hydrate wallet settings for ${normalized}:`,
|
||||
error,
|
||||
);
|
||||
@@ -4156,7 +4155,7 @@ export class ProfileModalController {
|
||||
try {
|
||||
return this.services.persistSavedProfiles(...args);
|
||||
} catch (error) {
|
||||
userLogger.warn(
|
||||
console.warn(
|
||||
"[ProfileModalController] Persist saved profiles service threw:",
|
||||
error,
|
||||
);
|
||||
@@ -4206,4 +4205,4 @@ export class ProfileModalController {
|
||||
}
|
||||
}
|
||||
|
||||
export default ProfileModalController;
|
||||
export default ProfileModalController;
|
||||
Reference in new issue
Block a user