gui.utils.logger
- File:
gui/utils/gui_logger.py
- Author:
Benjamin Jaedon Choi - https://github.com/saintbenjamin
- Affiliated Church:
The Eulji-ro Presbyterian Church [대한예수교장로회(통합) 을지로교회]
- Address:
The Eulji-ro Presbyterian Church, 24-10, Eulji-ro 20-gil, Jung-gu, Seoul 04549, South Korea
- Telephone:
+82-2-2266-3070
- E-mail:
euljirochurch [at] G.M.A.I.L. (replace [at] with @ and G.M.A.I.L as you understood.)
- License:
MIT License with Attribution Requirement (see LICENSE file for details); Copyright (c) 2025 The Eulji-ro Presbyterian Church.
Provides GUI-specific logging helpers for EuljiroBible, including error dialog and log viewer.
- gui.utils.logger.log_error_with_dialog(parent, exception, title='Error', extra_message=None)[source]
Log an exception and show a critical dialog with an optional “View Error Log” action.
This helper is intended for GUI-safe error reporting:
Always writes the exception to the application error log via log_error().
Shows a QMessageBox with the error text (and optional extra context).
If the user selects “View Error Log”, opens a MonitorErrorLog window.
- Parameters:
parent (QWidget | None) – Parent widget for the QMessageBox and log viewer window. If None, a standalone log viewer window is created.
exception (Exception) – The exception instance to log and present to the user.
title (str) – Dialog window title.
extra_message (str | None) – Optional context string shown above the exception message. Use this to explain what the app was trying to do when the error occurred.
- Returns:
None
- gui.utils.logger.handle_exception(exception, title='Error', user_message=None, parent=None)[source]
Handle an exception by logging it and showing a GUI dialog.
This is a convenience wrapper around log_error_with_dialog() for use across the GUI. Use this when you want a single call site that:
logs the exception
displays a user-facing message (optional)
keeps consistent dialog titles
- Parameters:
exception (Exception) – The exception instance to handle.
title (str) – Dialog window title.
user_message (str | None) – Optional, user-friendly context message shown in the dialog.
parent (QWidget | None) – Parent widget for the dialog (and log viewer if opened).
- Returns:
None
- class gui.utils.logger.MonitorErrorLog(*args, **kwargs)[source]
Bases:
QWidgetGUI window that displays the contents of the application’s error log file.
This viewer is used by error dialogs to let the user inspect paths.LOG_FILE without leaving the application. It renders the full file into a read-only QTextEdit.
- text_edit
Read-only text area showing the error log content.
- Type:
QTextEdit
- close_button
Button to close the window.
- Type:
QPushButton