molecular_simulations.logging_config module

Logging configuration module for molecular_simulations.

This module provides opt-in logging configuration for applications, CLIs, and examples. Library code should not call this implicitly.

molecular_simulations.logging_config.configure_logging(level=None, to_file=None, fmt=None)[source]

Configure logging for the application.

Opt-in configuration for apps/CLIs/examples. Library code should not call this implicitly.

Parameters:
  • level (str | int | None) – The logging level. Can be a string (e.g., ‘INFO’, ‘DEBUG’) or an integer. If None, uses the MS_LOG_LEVEL environment variable or defaults to ‘INFO’.

  • to_file (str | None) – Path to a log file. If None, uses the MS_LOG_FILE environment variable. If neither is set, logs only to console.

  • fmt (str | None) – Log message format string. If None, uses the MS_LOG_FMT environment variable or a default format including hostname, PID, and MPI rank.

Return type:

None

Example

>>> configure_logging(level="DEBUG", to_file="simulation.log")