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:
Daniel Volz
2026-02-14 20:28:06 +01:00
committed by GitHub
parent cbc71822b0
commit a016e45ef2
5 changed files with 48 additions and 5 deletions
+2 -1
View File
@@ -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"));
}