Added application-wide logging support for easier debugging#20
Open
ikabrain wants to merge 15 commits into
Open
Added application-wide logging support for easier debugging#20ikabrain wants to merge 15 commits into
ikabrain wants to merge 15 commits into
Conversation
Can now handle KeyboardInterrupts separately
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds structured Python logging across the application and documents how to enable debug output.
Changes:
- Introduces per-module
loggerusage and replaces silentexcept: pass/print(...)withlogger.warning/debug/exception(...). - Adds
INLINEA_DEBUG-driven logging configuration in__main__.py. - Documents debugging/logging workflow in the README.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/inlinea/window.py | Logs save-related failures and narrows broad exception handling on disconnect. |
| src/inlinea/utils/links.py | Logs link-extraction failures instead of silently ignoring them. |
| src/inlinea/ui/page_view.py | Logs URI-launch failures on link clicks. |
| src/inlinea/session_manager.py | Logs when the session file cannot be read/parsed. |
| src/inlinea/document/pdf_storage.py | Logs failures opening PDFs and parsing/writing annotations. |
| src/inlinea/document/loading.py | Logs Poppler open failures with context. |
| src/inlinea/document/engine/pool.py | Replaces print with structured exception logging in render worker. |
| src/inlinea/app.py | Improves CSS load diagnostics and logs failures. |
| src/inlinea/main.py | Configures stderr logging and debug mode via environment variable. |
| README.md | Adds logging/debugging instructions for terminal and journald workflows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Inlinea had a number of
exceptblocks that swallowed failures silently, including but not limited to aprint()in a render thread, bareexcept: passaround teardown, save errors that only surfaced as a toast, and PDF/annotation/session failures that vanished entirely.This PR adds Python's standard
loggingthroughout so those sites actually emit output, and configures the root logger so anything atWARNING+ lands on stderr (visible in a terminal orjournalctlwhen launched from the desktop).Changes
__main__.pyto write to stderr atWARNINGby default, with fullDEBUGoutput via theINLINEA_DEBUG=1env var.logging.getLogger(__name__)loggers todocument/engine/pool.py,app.py,document/pdf_storage.py,document/loading.py,session_manager.py,ui/page_view.py, andutils/links.py.print()in the render worker's error path (document/engine/pool.py) withlogger.exception, so render-thread tracebacks are captured instead of lost to stdout.app.pynow emit awarninginstead of being swallowed; switched the guard fromos.path.existstoos.access(..., os.R_OK)because GTK 4'sload_from_pathwarns rather than raising on an unreadable file, sothe old
exceptwas dead code.except:/except Exception:blocks arounddisconnect_by_funcinwindow.pytoexcept TypeError:, so they no longer catchKeyboardInterruptor mask unrelated errors.document/pdf_storage.pynow log at appropriate levels instead of discarding the exception.window.py(which already showed a "Save Failed" toast) now alsologger.exceptionthe cause; the Save-All-&-Quit loop logs too, so it matches the Ctrl+S / Save-As paths instead of being journal-silent.session_manager.pylog awarninginstead of silently returningNone; the app still starts.ui/page_view.py) and link-extraction failures (utils/links.py) now log instead ofexcept Exception: pass.document/loading.pylog awarningwith the underlyingGLib.Errorreason (encrypted / damaged / etc.) before returningNone; previously the cause was discarded before the UI ever saw it.Tested locally on Arch Linux (
python3 -m inlinea): clean launch with no spurious warnings, and each logging site verified by fault injection at unreadable CSS, corruptsession.json, a read-only save target, a non-PDF file, and broken annotation metadata underINLINEA_DEBUG=1. Each produced the expectedwarning/exceptionoutput while the happy path stayed silent.