feat: frontend LOG_LEVEL support via logger utility (#209)
- Inject LOG_LEVEL at build time via Vite define (__LOG_LEVEL__, default: warn) - Create frontend logger utility (frontend/src/utils/logger.ts) mirroring backend API - Replace all console.error calls with log.error in MedicationsPage, AppContext, Auth - Supports levels: silent > error > warn > info > debug Closes #205
This commit is contained in:
@@ -6,6 +6,7 @@ import { useMedicationForm, useUnsavedChangesWarning } from "../hooks";
|
||||
import type { DoseUnit, Medication } from "../types";
|
||||
import { DOSE_UNITS, FIELD_LIMITS, getPackageSize } from "../types";
|
||||
import { combineDateAndTime, formatDateTime, formatNumber } from "../utils/formatters";
|
||||
import { log } from "../utils/logger";
|
||||
|
||||
export function MedicationsPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -299,7 +300,7 @@ export function MedicationsPage() {
|
||||
setOriginalForm(form);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Save error:", err);
|
||||
log.error("Save error:", err);
|
||||
alert(err instanceof Error && err.message ? err.message : t("common.saveFailed"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user