visual-logging 2.0: modern packaging/CI, styled HTML pages, Jupyter support, max_size#19
Merged
Merged
Conversation
…x_size option - Replace setup.py/devrequirements.txt with pyproject.toml (version 2.0) - Replace dead Travis CI + coveralls setup with a GitHub Actions test matrix for Python 3.9-3.13 - Add max_size option to VisualRecord to downscale embedded images (inspired by PR #10) - Gate the matplotlib renderer on matplotlib itself instead of the deprecated pylab module (render_pylab kept as an alias) - Move tests to tests/, port them from nose to pytest and make the no-renderers corner case run in-process - Refresh README and demo.py, document logging.shutdown() (issue #8) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt
- Share the shrink-only scale policy between renderers via _fit_scale instead of two divergent per-renderer formulations - Downscale PIL images with resize() instead of a full-resolution copy() followed by in-place thumbnail() - Replace the dummy-module directory and hand-rolled sys.modules save/restore in the corner-case test with mock.patch.dict - Document that max_size does not apply to matplotlib figures Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt
…PI publishing - New HTMLFileHandler + VisualFormatter: self-contained styled html pages with level-colored record cards, timestamps, logger names, escaped plain-text records and tracebacks; flushed per record so the page can be watched mid-run. Both are plain logging.FileHandler/Formatter subclasses and compose the stdlib way; 1.x usage with a bare FileHandler keeps working - VisualRecord displays inline in Jupyter via _repr_html_ - max_size now applies to matplotlib figures too, by lowering savefig dpi - New render_numpy fallback: numpy arrays render via PIL when OpenCV is not installed - Embedded images get loading="lazy" so large logs open fast - Type hints throughout and a py.typed marker - publish.yml: build + publish to PyPI via trusted publishing on v* tags - demo.py showcases the new handler; README rewritten accordingly Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt
…rity - VisualFormatter now owns STYLE, the stylesheet for the cards it emits; HTMLFileHandler embeds its formatter's STYLE and keeps only page framing - Level CSS class is derived from record.levelno severity buckets, so custom levels from logging.addLevelName inherit the nearest standard color instead of rendering unstyled - Deduplicate the exc_info/stack_info traceback template - Drop the dead .record hr CSS rule Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt
This was referenced Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revives the project as a proper 2.0. Old API keeps working; everything new composes the stdlib
loggingway.Packaging
setup.py/devrequirements.txtwithpyproject.toml: version 2.0,requires-python >= 3.9, PyPI classifiers, atestextra,py.typedmarkerdevrequirements.txt(Pillow 2.5.1, matplotlib 1.4.1) should clear all open Dependabot alerts and supersedes Bump pillow from 2.5.1 to 9.3.0 #18CI / releasing
tests.yml: GitHub Actions matrix for Python 3.9–3.13publish.yml: builds and publishes to PyPI via trusted publishing onv*tags (one-time setup needed on PyPI: project → Publishing → add GitHub publisher for this repo, workflowpublish.yml, environmentpypi)New features
HTMLFileHandler+VisualFormatter— alogging.FileHandler/logging.Formatterpair producing a self-contained styled page: level-colored record cards, timestamps, logger names, dark-mode aware CSS; plain log messages are escaped and mix in;logger.exception(...)records include the traceback; records flush as emitted so the page can be watched mid-run. A bareFileHandlerstill produces 1.x-style fragments.max_size=(width, height)onVisualRecorddownscales oversized images (aspect ratio preserved) before embedding — OpenCV/PIL via resize, matplotlib by loweringsavefigdpi. Implements the idea from image resize option added #10.VisualRecorddisplays inline via_repr_html_.render_numpyfallback: numpy arrays render through PIL when OpenCV isn't installed.loading="lazy", so huge logs open fast.Code
_fit_scale()for the downscale policymatplotlibinstead of the deprecatedpylabmodule;render_pylabkept as an aliasTests
max_sizefor all three backends, lazy loading,_repr_html_, page structure, escaping, tracebacks, double-close; the no-renderers corner case usesmock.patch.dict(sys.modules, ...)instead of dummy modulesdemo.pyproduces a styled log with 7 records / 10 imagesDocs
logging.shutdown()documented (answers Great capability! How do I close the html? #8)🤖 Generated with Claude Code
https://claude.ai/code/session_01Ha16zNy2fDMdrZBMQGgpBt