Add events module with dashboard UI, scheduling, signups, and settings updates; extend env/readme.

This commit is contained in:
Pascal Prießnitz
2025-12-02 23:52:10 +01:00
parent 874b01c999
commit 829d160164
578 changed files with 37647 additions and 11590 deletions

View File

@@ -1,5 +1,25 @@
type LogLevel = 'INFO' | 'WARN' | 'ERROR';
type LogSink = (entry: { level: LogLevel; message: string; timestamp: number }) => void;
let sink: LogSink | null = null;
export const logger = {
info: (msg: string) => console.log(`[INFO] ${msg}`),
warn: (msg: string) => console.warn(`[WARN] ${msg}`),
error: (msg: string, err?: unknown) => console.error(`[ERROR] ${msg}`, err)
info: (msg: string) => {
const entry = { level: 'INFO' as LogLevel, message: msg, timestamp: Date.now() };
if (sink) sink(entry);
console.log(`[INFO] ${msg}`);
},
warn: (msg: string) => {
const entry = { level: 'WARN' as LogLevel, message: msg, timestamp: Date.now() };
if (sink) sink(entry);
console.warn(`[WARN] ${msg}`);
},
error: (msg: string, err?: unknown) => {
const entry = { level: 'ERROR' as LogLevel, message: msg, timestamp: Date.now() };
if (sink) sink(entry);
console.error(`[ERROR] ${msg}`, err);
},
setSink: (fn: LogSink | null) => {
sink = fn;
}
};