Revert "Refactor logging to centralized logger"

This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2025-10-15 11:14:10 -04:00
1 parent 2e7038e0e6
commit d705cf176b
67 files changed
+798 -1130

No files matched your search

+13 -14
View File
@@ -1,4 +1,3 @@
import { userLogger } from "./utils/logger.js";
// js/adminListStore.js
import {
@@ -152,7 +151,7 @@ function readJsonListFromStorage(key) {
return Array.isArray(parsed) ? parsed : null;
} catch (error) {
if (isDevMode) {
userLogger.warn(`[adminListStore] Failed to parse legacy list for ${key}:`, error);
console.warn(`[adminListStore] Failed to parse legacy list for ${key}:`, error);
}
return null;
}
@@ -200,7 +199,7 @@ function clearLegacyStorageFor(listKey) {
localStorage.removeItem(key);
} catch (error) {
if (isDevMode) {
userLogger.warn(`[adminListStore] Failed to clear legacy storage for ${key}:`, error);
console.warn(`[adminListStore] Failed to clear legacy storage for ${key}:`, error);
}
}
}
@@ -246,7 +245,7 @@ function encodeHexToNpub(hex) {
return window?.NostrTools?.nip19?.npubEncode(hex) || "";
} catch (error) {
if (isDevMode) {
userLogger.warn("Failed to encode hex pubkey to npub:", error);
console.warn("Failed to encode hex pubkey to npub:", error);
}
return "";
}
@@ -335,7 +334,7 @@ async function loadNostrList(identifier) {
}
} catch (error) {
if (isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] Combined relay fetch failed for ${identifier}:`,
error
);
@@ -350,7 +349,7 @@ async function loadNostrList(identifier) {
return Array.isArray(result) ? result : [];
} catch (error) {
if (isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] Relay fetch failed for ${identifier} on ${url}:`,
error
);
@@ -396,7 +395,7 @@ function buildListEvent(listKey, npubs, actorHex) {
return decodeNpubToHex(npub);
} catch (error) {
if (isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] Failed to decode npub while publishing ${listKey}:`,
error
);
@@ -414,7 +413,7 @@ function buildListEvent(listKey, npubs, actorHex) {
}
} catch (error) {
if (isDevMode) {
userLogger.warn("Failed to ensure super admin presence:", error);
console.warn("Failed to ensure super admin presence:", error);
}
}
}
@@ -459,7 +458,7 @@ function publishToRelay(url, signedEvent, listKey) {
return true;
} catch (error) {
if (isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] Relay publish rejected ${eventName} listener:`,
error
);
@@ -501,7 +500,7 @@ function publishToRelay(url, signedEvent, listKey) {
finalize(true);
}).then((result) => {
if (!result.success && isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] Publish failed for ${listKey} on ${result.url}:`,
result.error
);
@@ -606,7 +605,7 @@ async function persistNostrState(actorNpub, updates = {}) {
export async function loadAdminState() {
if (ADMIN_LIST_MODE !== "nostr" && isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] ADMIN_LIST_MODE "${ADMIN_LIST_MODE}" is deprecated. Defaulting to remote Nostr lists.`
);
}
@@ -615,7 +614,7 @@ export async function loadAdminState() {
if (!hasAnyEntries(state)) {
const legacy = loadLegacyAdminState();
if (legacy && isDevMode) {
userLogger.warn(
console.warn(
"[adminListStore] Ignoring legacy admin lists because remote mode is enforced. Publish them to Nostr to retain access.",
legacy
);
@@ -627,7 +626,7 @@ export async function loadAdminState() {
export async function persistAdminState(actorNpub, updates) {
if (ADMIN_LIST_MODE !== "nostr" && isDevMode) {
userLogger.warn(
console.warn(
`[adminListStore] ADMIN_LIST_MODE "${ADMIN_LIST_MODE}" is deprecated. Remote lists are enforced.`
);
}
@@ -638,4 +637,4 @@ export async function persistAdminState(actorNpub, updates) {
export const __adminListStoreTestHooks = Object.freeze({
extractNpubsFromEvent,
normalizeParticipantTagValue,
});
});