refactor(logging): implement unified Logger system to replace console calls

- Add Logger utility with tagged output and environment-based control
- Configure Babel to remove console calls in production builds
- Replace all console.* calls across stores, services, and components with Logger
- Enable development-only logging with formatted output and component tags
- Optimize production builds by eliminating all logging code
This commit is contained in:
zimplexing
2025-08-15 22:57:38 +08:00
parent 836285dbd5
commit e57466c8c1
25 changed files with 404 additions and 200 deletions

View File

@@ -2,6 +2,9 @@ import { create } from "zustand";
import { SettingsManager } from "@/services/storage";
import { api, ServerConfig } from "@/services/api";
import { storageConfig } from "@/services/storageConfig";
import Logger from "@/utils/Logger";
const logger = Logger.withTag('SettingsStore');
interface SettingsState {
apiBaseUrl: string;
@@ -65,7 +68,7 @@ export const useSettingsStore = create<SettingsState>((set, get) => ({
}
} catch (error) {
set({ serverConfig: null });
console.info("Failed to fetch server config:", error);
logger.error("Failed to fetch server config:", error);
} finally {
set({ isLoadingServerConfig: false });
}