Files
2026-07-12 14:06:45 +04:00

18 lines
474 B
Python

from datetime import datetime
from pathlib import Path
class AuditLogger:
"""
Класс для ведения журнала событий.
"""
def __init__(self, log_file: str):
self.log_file = Path(log_file)
def log(self, event: str) -> None:
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
line = f"[{timestamp}] {event}\n"
with open(self.log_file, "a", encoding="utf-8") as f:
f.write(line)