Logging
Use configure_logging to configure a jcmsuite logger. Use
get_logger when application or extension code must use the same logger
names.
Public logging namespace for jcmsuite.
- jcmsuite.logging.configure_logging(*, logger_name=_LOGGER_NAME, level=logging.INFO, stream=None, propagate=False)[source]
Configure and return a jcmsuite logger.
- Parameters:
logger_name (str, optional) – Name of the logger to configure.
level (int | str, optional) – Amount of information to write. Use a logging number or a name such as “INFO” or “TRACE”.
stream (TextIO | None, optional) – Destination for log messages, such as an open text file. If omitted, use the Python logging default.
propagate (bool, optional) – If True, also send each message to parent loggers.
- Returns:
Logger that uses the selected settings.
- Return type:
logging.Logger
- Raises:
ValueError – If level is an unknown logging level name.
- jcmsuite.logging.get_logger(name=None)[source]
Return a logger for jcmsuite messages.
- Parameters:
name (str | None, optional) – Name to add after jcmsuite. If omitted, return the main jcmsuite logger.
- Returns:
Requested logger. If necessary, the function first configures the main jcmsuite logger.
- Return type:
logging.Logger
- jcmsuite.logging.setup_logger(*, logging_level=None, log_dir=None, debug=False, stream=None, propagate=False, logger_name=_LOGGER_NAME)[source]
Configure where a logger writes jcmsuite messages.
- Parameters:
logging_level (int | None, optional) – Amount of information to write. If omitted, use logging.INFO.
log_dir (Path | None, optional) – Directory for jcmsuite.log. If omitted, do not write a log file.
debug (bool, optional) – If True, use logging.DEBUG and ignore logging_level.
stream (TextIO | None, optional) – Destination for log messages, such as an open text file. If omitted, use the Python logging default.
propagate (bool, optional) – If True, also send each message to parent loggers.
logger_name (str, optional) – Name of the logger to configure.
- Returns:
Logger that uses the selected settings.
- Return type:
logging.Logger
Trace Level
- jcmsuite.logging.TRACE = 5
Numeric logging level below DEBUG used for detailed trace messages.
- jcmsuite.logging.TRACE_NAME = "TRACE"
Name registered for the TRACE logging level.