📚 Improved log file management system across various components 🎉
This commit is contained in:
@ -134,14 +134,14 @@ class RouteDiscovery:
|
||||
|
||||
# Dynamische Parameter ersetzen
|
||||
if '<' in route:
|
||||
route = self._resolve_dynamic_route(route)
|
||||
if route:
|
||||
discovered_routes.extend(route if isinstance(route, list) else [route])
|
||||
resolved_routes = self._resolve_dynamic_route(route)
|
||||
if resolved_routes:
|
||||
for resolved_route in resolved_routes:
|
||||
discovered_routes.append(resolved_route)
|
||||
self._categorize_route(resolved_route)
|
||||
else:
|
||||
discovered_routes.append(route)
|
||||
|
||||
# Kategorisierung der Routen
|
||||
self._categorize_route(route)
|
||||
self._categorize_route(route)
|
||||
|
||||
logger.info(f"✅ {len(discovered_routes)} Routen aus Flask-App extrahiert")
|
||||
return discovered_routes
|
||||
@ -612,6 +612,56 @@ class ScreenshotTool:
|
||||
|
||||
logger.info(f"📝 Menschenlesbarer Bericht gespeichert: {report_path}")
|
||||
|
||||
def load_config_from_file(config_file: str = "screenshot_config.json") -> ScreenshotConfiguration:
|
||||
"""Lädt Konfiguration aus JSON-Datei"""
|
||||
config = ScreenshotConfiguration()
|
||||
|
||||
if os.path.exists(config_file):
|
||||
try:
|
||||
with open(config_file, 'r', encoding='utf-8') as f:
|
||||
config_data = json.load(f)
|
||||
|
||||
# Server-Konfiguration laden
|
||||
if 'server' in config_data:
|
||||
server_config = config_data['server']
|
||||
config.BASE_URL = server_config.get('base_url', config.BASE_URL)
|
||||
config.ADMIN_EMAIL = server_config.get('admin_email', config.ADMIN_EMAIL)
|
||||
config.ADMIN_PASSWORD = server_config.get('admin_password', config.ADMIN_PASSWORD)
|
||||
|
||||
# Browser-Konfiguration laden
|
||||
if 'browser' in config_data:
|
||||
browser_config = config_data['browser']
|
||||
config.BROWSER_TYPE = browser_config.get('type', config.BROWSER_TYPE)
|
||||
config.HEADLESS = browser_config.get('headless', config.HEADLESS)
|
||||
config.PAGE_LOAD_TIMEOUT = browser_config.get('page_load_timeout', config.PAGE_LOAD_TIMEOUT)
|
||||
config.ELEMENT_WAIT_TIMEOUT = browser_config.get('element_wait_timeout', config.ELEMENT_WAIT_TIMEOUT)
|
||||
config.SCREENSHOT_DELAY = browser_config.get('screenshot_delay', config.SCREENSHOT_DELAY)
|
||||
|
||||
# Output-Konfiguration laden
|
||||
if 'output' in config_data:
|
||||
output_config = config_data['output']
|
||||
config.SCREENSHOT_BASE_DIR = output_config.get('base_directory', config.SCREENSHOT_BASE_DIR)
|
||||
|
||||
# Auflösungen laden
|
||||
if 'resolutions' in config_data:
|
||||
resolutions_config = config_data['resolutions']
|
||||
new_resolutions = {}
|
||||
for name, res_data in resolutions_config.items():
|
||||
if isinstance(res_data, dict) and 'width' in res_data and 'height' in res_data:
|
||||
new_resolutions[name] = (res_data['width'], res_data['height'])
|
||||
if new_resolutions:
|
||||
config.RESOLUTIONS = new_resolutions
|
||||
|
||||
logger.info(f"✅ Konfiguration aus {config_file} geladen")
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(f"⚠️ Fehler beim Laden der Konfiguration aus {config_file}: {e}")
|
||||
logger.info("💡 Verwende Standard-Konfiguration")
|
||||
else:
|
||||
logger.info(f"📋 Keine Konfigurationsdatei {config_file} gefunden - verwende Standard-Werte")
|
||||
|
||||
return config
|
||||
|
||||
def main():
|
||||
"""Hauptfunktion des Screenshot-Tools"""
|
||||
print("=" * 60)
|
||||
@ -624,10 +674,10 @@ def main():
|
||||
print("💡 Führen Sie aus: pip install selenium")
|
||||
return 1
|
||||
|
||||
# Konfiguration erstellen
|
||||
config = ScreenshotConfiguration()
|
||||
# Konfiguration aus Datei laden
|
||||
config = load_config_from_file()
|
||||
|
||||
# Benutzer-Eingaben für Konfiguration
|
||||
# Benutzer-Eingaben für Konfiguration (optional)
|
||||
print("\n📋 KONFIGURATION")
|
||||
print("-" * 30)
|
||||
|
||||
|
Reference in New Issue
Block a user