mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Refactor logging to centralized logger
This commit is contained in:
1 parent
08d770162b
commit
37ba57aa37
67 files changed
+1130
-798
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
const STORAGE_KEY = "bitvid:theme";
|
||||
const FALLBACK_THEME = "dark";
|
||||
const VALID_THEMES = new Set(["light", "dark"]);
|
||||
@@ -42,7 +43,7 @@ const readStoredTheme = () => {
|
||||
const stored = window.localStorage.getItem(STORAGE_KEY);
|
||||
return normalizeTheme(stored);
|
||||
} catch (error) {
|
||||
console.warn("Unable to read stored theme preference:", error);
|
||||
userLogger.warn("Unable to read stored theme preference:", error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -54,7 +55,7 @@ const persistTheme = (theme) => {
|
||||
try {
|
||||
window.localStorage.setItem(STORAGE_KEY, theme);
|
||||
} catch (error) {
|
||||
console.warn("Unable to persist theme preference:", error);
|
||||
userLogger.warn("Unable to persist theme preference:", error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -92,7 +93,7 @@ const updateThemeColorMeta = (theme) => {
|
||||
.trim();
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Unable to compute theme color token:", error);
|
||||
userLogger.warn("Unable to compute theme color token:", error);
|
||||
}
|
||||
|
||||
const fallback = FALLBACK_META_COLORS[theme] || FALLBACK_META_COLORS[FALLBACK_THEME];
|
||||
@@ -179,7 +180,7 @@ const collectToggleElements = (root = document) => {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn(`Invalid selector for theme toggle: ${selector}`, error);
|
||||
userLogger.warn(`Invalid selector for theme toggle: ${selector}`, error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -269,4 +270,3 @@ export const initThemeController = () => {
|
||||
applyTheme(initialTheme, { persist: true });
|
||||
refreshThemeControls(document);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user