serena.gui_log_viewer#
Source code: serena/gui_log_viewer.py
- class LogLevel(
- value,
- names=<not given>,
- *values,
- module=None,
- qualname=None,
- type=None,
- start=1,
- boundary=None,
Bases:
Enum
- class GuiLogViewer(
- mode,
- title='Log Viewer',
- memory_log_handler=None,
- width=800,
- height=600,
- shutdown_handler=None,
Bases:
objectA class that creates a Tkinter GUI for displaying log messages in a separate thread. The log viewer supports coloring based on log levels (DEBUG, INFO, WARNING, ERROR). It can also highlight tool names in boldface when they appear in log messages.
- Parameters:
mode (Literal['dashboard', 'error']) – the mode; if “dashboard”, run a dashboard with logs and some control options; if “error”, run a simple error log viewer (for fatal exceptions)
title – the window title
memory_log_handler (MemoryLogHandler | None) – an optional log handler from which to obtain log messages; If not provided, must pass the instance to a GuiLogViewerHandler to add log messages.
width – the initial window width
height – the initial window height
shutdown_handler (Callable[[], None] | None)
- set_tool_names(tool_names)[source]#
Set or update the list of tool names to be highlighted in log messages.
- Args:
tool_names (list): A list of tool name strings to highlight
- class GuiLogViewerHandler(
- log_viewer,
- level=0,
- format_string='%(levelname)-5s %(asctime)-15s %(name)s:%(funcName)s:%(lineno)d - %(message)s',
Bases:
HandlerA logging handler that sends log records to a ThreadedLogViewer instance. This handler can be integrated with Python’s standard logging module to direct log entries to a GUI log viewer.
Initialize the handler with a ThreadedLogViewer instance.
- Args:
log_viewer: A ThreadedLogViewer instance that will display the logs level: The logging level (default: NOTSET which captures all logs) format_string: the format string
- Parameters:
log_viewer (GuiLogViewer)
format_string (str | None)