jdxi_editor.ui.widgets.viewer.log
This module provides a graphical log viewer using PySide6. The LogViewer class is a QMainWindow-based widget that displays the log file written by Decologr. It automatically refreshes to show new log entries.
Classes:
LogViewer: A main window that displays the log file and refreshes automatically.
Features:
Dark theme with a modern red-accented styling, in fixed-width text so the columns line up; the emoji Decologr puts before each message are left out (the level column already says it).
Two tabs: every line, and the lines that deserve attention (warnings, errors and what follows them, e.g. a traceback).
Automatically reads and displays the log file written by Decologr. Each run writes a file named after the time it started, rotated at 1MB, so the file to read is taken from the installed log handler rather than from a fixed path (see
resolve_log_file()).Refreshes periodically to show new log entries, and follows the file across rotation. It reads bytes and holds a line still being written, so no line is broken or shown twice.
Provides a “Clear Log” button: the lines written from then on appear.
Auto-scrolls to the bottom to show the latest entries.
Usage Example:
>>> viewer = LogViewer()
>>> viewer.show()
Attributes
Classes
Functions
|
Directory Decologr writes log files to. |
|
The log file currently being written. |
|
A fixed-width font for the log lines. |
|
The line without the emoji Decologr puts before each message. |
|
The lines with a level from WARNING up, with the lines that continue them. |
Module Contents
- jdxi_editor.ui.widgets.viewer.log.log_directory() pathlib.Path[source]
Directory Decologr writes log files to.
- Returns:
Path
- jdxi_editor.ui.widgets.viewer.log.resolve_log_file(log_dir: pathlib.Path | None = None) pathlib.Path | None[source]
The log file currently being written.
Decologr names each run’s file after the time it started (
jdxi_editor-01Feb2026-10-32-09.log) and rotates it at 1MB, so there is no file at a fixed path to open. The handler installed bysetup_loggingknows the name, so it is asked first; failing that, the newest file in the log directory is used, preferring one that is not a rotated backup.- Parameters:
log_dir – Optional[Path] directory to search; defaults to
log_directory()- Returns:
Optional[Path] the log file, or None if there is none
- jdxi_editor.ui.widgets.viewer.log.fixed_font() PySide6.QtGui.QFont[source]
A fixed-width font for the log lines.
- jdxi_editor.ui.widgets.viewer.log.clean(line: str) str[source]
The line without the emoji Decologr puts before each message.
- jdxi_editor.ui.widgets.viewer.log.needs_attention(lines: list[str], following: bool = False) tuple[list[str], bool][source]
The lines with a level from WARNING up, with the lines that continue them.
- Parameters:
lines – list[str] log lines
following – bool the line before lines continued a warning or an error
- Returns:
(the lines kept, whether the last line continues one)