Commit Graph

12 Commits

Author SHA1 Message Date
Jannik S.
140ab270af fix: correct ENABLE_AUDIT_STDOUT stdout filter (#21777) 2026-02-23 11:52:29 -06:00
Timothy Jaeryang Baek
9044abf3bb chore: format 2026-02-23 01:40:53 -06:00
Andrei Efanov
9e81e1dda1 feat: add LOG_FORMAT=json for structured JSON logging (#21747)
* feat: add LOG_FORMAT env var with JSON formatter for early logging

Introduce LOG_FORMAT environment variable (set to "json" to enable).
When active, logging.basicConfig() uses a JSONFormatter that outputs
single-line JSON objects with fields: ts, level, msg, caller, error,
stacktrace. This covers all log messages emitted during module imports
before Loguru's start_logger() takes over.

* feat: add JSON sink for Loguru when LOG_FORMAT=json

Add _json_sink() as a Loguru sink function that writes single-line JSON
to stdout. In start_logger(), conditionally use the JSON sink instead of
the plain-text stdout_format when LOG_FORMAT is set to "json".

* feat: suppress ASCII banner and fix alembic logging in JSON mode

- Wrap the ASCII art banner print in main.py with a LOG_FORMAT != "json"
  guard so JSON output stays machine-parseable.
- Skip alembic's fileConfig() call in migrations/env.py when
  LOG_FORMAT=json to prevent it from replacing the JSON log handlers
  installed during early startup.
2026-02-22 17:40:17 -06:00
Timothy Jaeryang Baek
f376d4f378 chore: format 2026-02-11 16:24:11 -06:00
Timothy Jaeryang Baek
fdae5644e3 refac 2026-01-01 01:51:37 +04:00
Timothy Jaeryang Baek
5d4199bf52 chore: format 2025-08-06 14:27:58 +04:00
Tim Jaeryang Baek
0b627248f5 Merge pull request #15640 from ipapapa/feat/cleaner-logs
refactor(logger): Conditionally include extra_json in logs
2025-08-04 17:52:12 +04:00
expruc
2035eabb1f added otel logging handler 2025-07-31 21:58:49 +03:00
Adam Tao
739098ab60 feat(logger): Add trace_id and span_id to log
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
2025-07-19 18:36:54 +08:00
Ioannis Papapanagiotou
54d606eabf refactor(logger): Conditionally include extra_json in logs 2025-07-11 01:29:27 -07:00
Timothy Jaeryang Baek
e28bc37e41 enh: AUDIT_UVICORN_LOGGER_NAMES 2025-07-03 21:54:25 +04:00
Victor Ribeiro
39c6ecb50d feat: add audit logger middleware and custom logger using loguru 2025-02-20 11:15:38 -03:00