Skip to content

Make View & Modal's default impl of on_error() use logging.error() instead of print(file=sys.stderr) - #264

Open
anamoyee wants to merge 2 commits into
hypergonial:mainfrom
anamoyee:feature/view__on_error__uses_logging
Open

Make View & Modal's default impl of on_error() use logging.error() instead of print(file=sys.stderr)#264
anamoyee wants to merge 2 commits into
hypergonial:mainfrom
anamoyee:feature/view__on_error__uses_logging

Conversation

@anamoyee

Copy link
Copy Markdown
Contributor

This change allows for logging the "Ignoring exception in view" errors + compatibility with logging customizers (e.g. rich.logging or a manual impl of a handler), which formats tracebacks in a different way than python's default. Before this change the way to do it would be to subclass miru.View and import & remember to use that subclass across the project. I think this change makes for a nicer default.

Example (upper half some other error, lower half miru's error):
image

With this change:
image

@anamoyee anamoyee changed the title Make View & Modal's default on_error() callbacks use logging.error() instead of print(file=sys.stderr) Make View & Modal's default impl of on_error() use logging.error() instead of print(file=sys.stderr) Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant