logger.ts19 lines · main
| 1 | import { createLogger } from '@briven/shared/observability'; |
| 2 | |
| 3 | import { env } from '../env.js'; |
| 4 | |
| 5 | /** |
| 6 | * Structured JSON logger. Per CLAUDE.md §5.1: |
| 7 | * - log structure, never customer content |
| 8 | * - redact credentials; never log IPs or emails |
| 9 | * - log shape stays stable so Grafana/Loki queries are cheap |
| 10 | * |
| 11 | * Delegates to the shared `createLogger` factory, which applies redaction |
| 12 | * recursively across `msg` and `fields` so no caller can accidentally leak |
| 13 | * an email or IPv4 into Loki even if they forget to scrub it locally. |
| 14 | */ |
| 15 | export const log = createLogger({ |
| 16 | service: 'api', |
| 17 | env: env.BRIVEN_ENV, |
| 18 | level: env.BRIVEN_LOG_LEVEL, |
| 19 | }); |