Logging

Structured JSON console logging for production and log aggregators.

The redup_servicekit.logging module contains:

init_console_log(level='INFO')[source]

Create the root logger with a single JSON console handler.

All other loggers are set to CRITICAL so only this handler’s output is visible. JSON fields include asctime, created, filename, funcName, levelname, lineno, module, message, process, thread, threadName.

Parameters:

level (str) – Log level name (e.g. "INFO", "DEBUG"). Default "INFO".

Returns:

The root logger instance.

Return type:

logging.Logger

Raises:

ValueError – If the level string is not a valid level name.

Example:

>>> from redup_servicekit.logging import init_console_log
>>> logger = init_console_log(level="INFO")
>>> logger.info("Service started")