mathxlab.exp.logging

Logging utilities for experiment runs.

Stability

Status: Experimental.

This project treats the documented names as the public surface, but details may still evolve. If you need strict API guarantees, add __all__ = [...] to each module and version releases accordingly.

Design notes

  • Keep experiment scripts small: delegate I/O, seeding, and logging here.

  • Aim for reproducible outputs (fixed seeds, stable file names).

Examples

Enable verbose logging for mathxlab code

from mathxlab.exp.logging import LoggingConfig, setup_logging
setup_logging(config=LoggingConfig(verbose=True))

Public API

Name

Kind

Summary

LoggingConfig

class

Configuration for experiment logging.

setup_logging

function

Set up logging for experiment runs.

get_logger

function

Get a logger for a specific module.

Reference

Classes

class mathxlab.exp.logging.LoggingConfig(package_prefix='mathxlab', verbose=False, log_file=None)[source]

Bases: object

Configuration for experiment logging.

Parameters:
  • package_prefix – Logger name prefix considered “our code” (default: “mathxlab”).

  • verbose – If True, emit DEBUG logs for package_prefix only.

  • log_file – Optional file path for logs (UTF-8). The file is overwritten each run.

Examples

>>> from mathxlab.exp.logging import LoggingConfig
>>> LoggingConfig

Functions

mathxlab.exp.logging.setup_logging(*, config=None)[source]

Set up logging for experiment runs.

Design goal:
  • Show INFO+ from all libraries (progress + warnings).

  • Show DEBUG only from our code (by logger name prefix).

This prevents very noisy third-party DEBUG output (e.g. matplotlib/PIL) while still allowing you to turn on detailed debugging for the repository code.

Parameters:

config – Logging configuration. If omitted, defaults are used.

Examples

>>> from mathxlab.exp.logging import LoggingConfig, setup_logging
>>> setup_logging(config=LoggingConfig(verbose=True))
>>> import logging; logging.getLogger("mathxlab").debug("debug enabled")
mathxlab.exp.logging.get_logger(name)[source]

Get a logger for a specific module.

Parameters:

name – Name of the module.

Returns:

A logging.Logger instance.

Examples

>>> from mathxlab.exp.logging import get_logger
>>> get_logger