logger_utils

Utilities to create and set the logger.

Manim’s logger can be accessed as manim.logger, or as logging.getLogger("manim"), once the library has been imported. Manim also exports a second object, console, which should be used to print on screen messages that need not be logged.

Both logger and console use the rich library to produce rich text format.

Classes

JSONFormatter

A formatter that outputs logs in a custom JSON format.

Functions

make_logger(parser, verbosity)[source]

Make the manim logger and console.

Parameters:
  • parser (SectionProxy) – A parser containing any .cfg files in use.

  • verbosity (str) – The verbosity level of the logger.

Returns:

The manim logger and consoles. The first console outputs to stdout, the second to stderr. All use the theme returned by parse_theme().

Return type:

logging.Logger, rich.Console, rich.Console

Notes

The parser is assumed to contain only the options related to configuring the logger at the top level.

parse_theme(parser)[source]

Configure the rich style of logger and console output.

Parameters:

parser (SectionProxy) – A parser containing any .cfg files in use.

Returns:

The rich theme to be used by the manim logger.

Return type:

rich.Theme

See also

make_logger()

set_file_logger(log_file_path)[source]

Add a file handler for one exact, already resolved log path.

Parameters:

log_file_path (Path) – Exact path of the log file for this scene.

Return type:

None