Skip to content

Logging

flowMC.utils.logging ¤

Centralized logging utilities for flowMC.

This module provides utilities to configure logging for flowMC components in a consistent and isolated manner.

enable_verbose_logging(logger: logging.Logger, level: int = logging.DEBUG, format_string: Optional[str] = None) -> None ¤

Enable verbose logging for a specific logger.

This function configures a logger to output debug messages in an isolated way, without affecting other loggers in the application. It: - Sets the logger's level to the specified level (default: DEBUG) - Disables propagation to parent loggers to avoid interference - Adds a StreamHandler if one doesn't already exist

Parameters:

Name Type Description Default
logger Logger

The logger instance to configure.

required
level int

The logging level to set (default: logging.DEBUG).

DEBUG
format_string Optional[str]

Custom format string for log messages. If None, uses a default format: '%(name)s - %(levelname)s - %(message)s'

None
Example

import logging from flowMC.utils.logging import enable_verbose_logging

logger = logging.getLogger(name) enable_verbose_logging(logger) logger.debug("This will now be printed")

disable_verbose_logging(logger: logging.Logger) -> None ¤

Disable verbose logging and restore default behavior.

This function resets a logger to its default state: - Resets the logger's level to NOTSET (inherits from parent) - Re-enables propagation to parent loggers - Removes any handlers that were added

Parameters:

Name Type Description Default
logger Logger

The logger instance to reset.

required