Pause added to stop changing log window
This commit is contained in:
parent
dc92c0d4d1
commit
554f19fc6c
13
loggy.py
13
loggy.py
@ -64,14 +64,16 @@ class LogViewerApp(App):
|
||||
CSS_PATH = "style.tcss"
|
||||
BINDINGS = [
|
||||
("q", "quit", "Quit"),
|
||||
("c", "clear_screen", "Clear")
|
||||
("c", "clear_screen", "Clear"),
|
||||
("p", "pause", "Pause")
|
||||
]
|
||||
MAX_LOGS = 1000
|
||||
MAX_LOGS = 5000
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
#
|
||||
self.all_logs = []
|
||||
self.__logging_enabled__ = True
|
||||
self.__module_selection__ = MultiSelect((), prompt="Module", id="module_filter")
|
||||
self.__level_selection__ = MultiSelect((), prompt="Level", id="level_filter")
|
||||
self.force_critical = True
|
||||
@ -131,13 +133,18 @@ class LogViewerApp(App):
|
||||
f"[bold]{record.name}[/bold] - "
|
||||
f"{record.getMessage()}"
|
||||
)
|
||||
|
||||
if self.__logging_enabled__:
|
||||
self.log_display.write(message)
|
||||
|
||||
def action_clear_screen(self):
|
||||
self.all_logs = []
|
||||
self._update_display()
|
||||
|
||||
def action_pause(self):
|
||||
self.__logging_enabled__ = not self.__logging_enabled__
|
||||
if self.__logging_enabled__:
|
||||
self._update_display()
|
||||
|
||||
def _update_display(self):
|
||||
"""Löscht die Anzeige und rendert alle Logs basierend auf den aktuellen Filtern neu."""
|
||||
self.log_display.clear()
|
||||
|
Loading…
x
Reference in New Issue
Block a user