app.infra.logging_setup
Minimal stdlib-only logging setup with console and JSON file output.
ConsoleFormatter
Bases: Formatter
Single-line console formatter: YYYY-MM-DD HH:MM:SS | LEVEL | logger.name | message
JSONFormatter
Bases: Formatter
JSON formatter with fields: ts, level, logger, message, pathname, lineno, funcName, process, threadName
get_logger(name=__name__)
Get a logger instance
init_logging(level='INFO', log_dir='logs', log_file='app.log', rotate_max_bytes=10 * 1024 * 1024, rotate_backups=5, ecs_compatible=False)
Initialize logging with console and rotating file handlers (idempotent).
| Parameters: |
|
|---|