log-get-logger (BTLOG001)¶
Added in 0.8.0 · Stable · Enabled by default (warning)
Family: logging · Standard: CES-45 · Languages: python
Directive¶
Never call logging.getLogger(...), or a bare getLogger(...), directly. Get loggers from the
house get_logger of core/logger.py, the structlog setup that
botica refs show structured-logging prints. A warning by default.
Why¶
- One configuration point makes every module log the same way: JSON in production, a coloured
console in development, the level from
LOG_LEVEL. ScatteredgetLoggercalls drift into inconsistent formats and lost context. get_loggerreturns a structlogBoundLogger, so you can.bind(request_id=...)context and emit key/value events instead of pre-formatted strings.
Do¶
Don't¶
Suppression¶
A comment on the line of the getLogger(...) call silences it.