Logging Tool for report building
This is a set of functions for constructing and organising the HTML report built by the diagnostic scripts. We do not recommend users use these as they are optimised for this specific application.
StatsReporter
Enhanced StatsReporter
- log_section(section_id, title): mark a new named section in the log
- log_plot(fig, caption, section=None): attach a plot to a section (defaults to last section)
- write_report(...) builds a TOC with hyperlinks and places each section's plots immediately after its logs.
artifacts
property
List of any files saved in addition to the HTML report.
log_section(section_id, title)
Start a named section. The section_id should be unique-ish (used for anchors). Logs a header line (so it appears in the plaintext log too).
log_summary(test_name, summary)
Write a one-line header + pretty key/val summary via logger.
log_text(message, level=logging.INFO)
Free-form text to the log.
text_simple(message, level=logging.INFO)
Log without date and time to reduce clutter
log_plot(fig, caption='Plot', section=None)
Accepts a matplotlib Figure, attaches it to a section (or last section if None), embeds it into the HTML report, and (optionally) saves it as a PNG in save_dir when save_artifacts=True.
write_report(path=None)
Write (or rewrite) the HTML report and return its path.