Files
secu-backend/src/middleware/logger.ts
OpenClaw ee19e45171 🚀 Backend komplett implementiert
Features:
- Auth mit JWT + Argon2 (Login, Register, Refresh)
- Rollen-System (Chef/Disponent/Mitarbeiter)
- User Management mit Berechtigungen
- Aufträge mit Zuweisungen
- Verfügbarkeitsplanung
- Stundenzettel mit Foto-Upload Support
- Modulares System mit Config
- Entwickler-Panel Endpoints

Tech:
- Deno + Oak
- PostgreSQL
- CORS enabled
2026-02-20 15:12:06 +00:00

18 lines
512 B
TypeScript

import { Context, Next } from "@oak/oak";
export async function requestLogger(ctx: Context, next: Next): Promise<void> {
const start = Date.now();
await next();
const ms = Date.now() - start;
const status = ctx.response.status;
const method = ctx.request.method;
const url = ctx.request.url.pathname;
const color = status >= 500 ? "\x1b[31m" : status >= 400 ? "\x1b[33m" : "\x1b[32m";
const reset = "\x1b[0m";
console.log(`${color}${status}${reset} ${method} ${url} - ${ms}ms`);
}