logler 1.0.7__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- logler/__init__.py +22 -0
- logler/bootstrap.py +57 -0
- logler/cache.py +75 -0
- logler/cli.py +589 -0
- logler/helpers.py +282 -0
- logler/investigate.py +3962 -0
- logler/llm_cli.py +1426 -0
- logler/log_reader.py +267 -0
- logler/parser.py +207 -0
- logler/safe_regex.py +124 -0
- logler/terminal.py +252 -0
- logler/tracker.py +138 -0
- logler/tree_formatter.py +807 -0
- logler/watcher.py +55 -0
- logler/web/__init__.py +3 -0
- logler/web/app.py +810 -0
- logler/web/static/css/tailwind.css +1 -0
- logler/web/static/css/tailwind.input.css +3 -0
- logler/web/static/logler-logo.png +0 -0
- logler/web/tailwind.config.cjs +9 -0
- logler/web/templates/index.html +1454 -0
- logler-1.0.7.dist-info/METADATA +584 -0
- logler-1.0.7.dist-info/RECORD +28 -0
- logler-1.0.7.dist-info/WHEEL +4 -0
- logler-1.0.7.dist-info/entry_points.txt +2 -0
- logler-1.0.7.dist-info/licenses/LICENSE +21 -0
- logler_rs/__init__.py +5 -0
- logler_rs/logler_rs.cp311-win_amd64.pyd +0 -0
logler/watcher.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
File watching with regex pattern matching.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import fnmatch
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from watchdog.observers import Observer
|
|
9
|
+
from watchdog.events import FileSystemEventHandler
|
|
10
|
+
|
|
11
|
+
from rich.console import Console
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class LogFileHandler(FileSystemEventHandler):
|
|
15
|
+
"""Handle log file events."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, pattern: str, callback):
|
|
18
|
+
self.pattern = pattern
|
|
19
|
+
self.callback = callback
|
|
20
|
+
|
|
21
|
+
def on_created(self, event):
|
|
22
|
+
"""Handle file creation."""
|
|
23
|
+
if not event.is_directory:
|
|
24
|
+
path = Path(event.src_path)
|
|
25
|
+
if fnmatch.fnmatch(path.name, self.pattern):
|
|
26
|
+
self.callback(path)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class FileWatcher:
|
|
30
|
+
"""Watch for new log files matching a pattern."""
|
|
31
|
+
|
|
32
|
+
def __init__(self, pattern: str, directory: str = ".", recursive: bool = False):
|
|
33
|
+
self.pattern = pattern
|
|
34
|
+
self.directory = Path(directory)
|
|
35
|
+
self.recursive = recursive
|
|
36
|
+
self.console = Console()
|
|
37
|
+
|
|
38
|
+
async def watch(self):
|
|
39
|
+
"""Start watching for files."""
|
|
40
|
+
observer = Observer()
|
|
41
|
+
|
|
42
|
+
def on_file_created(path: Path):
|
|
43
|
+
self.console.print(f"[green]✓[/green] New file: [cyan]{path}[/cyan]")
|
|
44
|
+
|
|
45
|
+
handler = LogFileHandler(self.pattern, on_file_created)
|
|
46
|
+
observer.schedule(handler, str(self.directory), recursive=self.recursive)
|
|
47
|
+
observer.start()
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
while True:
|
|
51
|
+
await asyncio.sleep(1)
|
|
52
|
+
except KeyboardInterrupt:
|
|
53
|
+
observer.stop()
|
|
54
|
+
|
|
55
|
+
observer.join()
|
logler/web/__init__.py
ADDED