From 6f0ff4bc00ecdf92f3e5728fded5a179f67ae3eb Mon Sep 17 00:00:00 2001 From: hubobel Date: Sat, 27 Dec 2025 11:10:29 +0100 Subject: [PATCH] =?UTF-8?q?.log=20Unterst=C3=BCtzung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Simbriefimport.py | 65 +++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/Simbriefimport.py b/Simbriefimport.py index e06f197..493b4f9 100644 --- a/Simbriefimport.py +++ b/Simbriefimport.py @@ -13,6 +13,7 @@ from logging.handlers import RotatingFileHandler def setup_logging(app_dir, level=logging.INFO, console=True): + logging.getLogger("httpx").setLevel(logging.WARNING) log_file = app_dir / "Simbriefimport.log" logger = logging.getLogger() @@ -163,7 +164,8 @@ def ai(prompt): def stimmung(): tone = (passw['Prompt']['tone']) tone = random.choice(list(tone)) - print(tone) + + #print(tone) return tone def WelcomePilot(): prompt_org = passw['Prompt']['CptPrompt'] @@ -295,8 +297,8 @@ def Simbriefimport(): zfw = data['weights']['est_zfw'] airline_icao = general.get("icao_airline") route = data['general']['route'] - print(data.keys()) - print(data['general']['route']) + #print(data.keys()) + #print(data['general']['route']) return (zfw, tow, payload, pax, metar_dest, metar_origin, fuel, distance, fl, flightlevel, flightnumber, airline, aircraft_name, aircraft_icao, land_time, start_time, block, time, aircraft, dest_icao, dest_name, dest, origin_icao, origin_name, origin, general, airline_icao, route) @@ -321,7 +323,8 @@ def BACKUP(Pfad): # Prüfen, ob BACKUP bereits existiert if backup_dir.exists(): - print("BACKUP existiert bereits – keine Dateien wurden kopiert.") + logging.info("BACKUP existiert bereits – keine Dateien wurden kopiert.") + #print("BACKUP existiert bereits – keine Dateien wurden kopiert.") else: # BACKUP anlegen backup_dir.mkdir(parents=True) @@ -334,7 +337,10 @@ def BACKUP(Pfad): shutil.copy2(src, dst) print(f"Kopiert: {src.name}") - print(f"Backup erstellt. {len(txt_files)} Datei(en) gesichert.") + logging.info( + "Backup erstellt. %d Datei(en) gesichert.", + len(txt_files) + ) return None @@ -350,12 +356,20 @@ setup_logging(app_dir, level=logging.INFO, console=True) conf_file = app_dir / "Simbriefimport.conf" if conf_file.exists(): - print("Konfigurationsdatei gefunden:", conf_file) + #print("Konfigurationsdatei gefunden:", conf_file) + logging.info( + "Konfigurationsdatei gefunden: %s", + conf_file + ) with open(conf_file) as file: passw = json.load(file) else: - print("Keine Konfigurationsdatei vorhanden:", conf_file) + #print("Keine Konfigurationsdatei vorhanden:", conf_file) + logging.info( + "keine Konfigurationsdatei gefunden: %s", + conf_file + ) #passw = conf() client = OpenAI( @@ -369,32 +383,33 @@ Stimmung = str(stimmung()) (zfw, tow, payload, pax, metar_dest, metar_origin, fuel, distance, fl, flightlevel, flightnumber, airline, aircraft_name, aircraft_icao, land_time, start_time, block, time, aircraft, dest_icao, dest_name, dest, origin_icao, origin_name, origin, general, airline_icao, route) = Simbriefimport() - +logging.info("Stimmung: %s", Stimmung) logging.info("--------------------------------------------------") logging.info("FLUGINFORMATIONEN") logging.info("--------------------------------------------------") -logging.info("Airline (ICAO): %s", general.get("icao_airline")) -logging.info("Airlinename: %s", airline) -logging.info("Flugnummer: %s", general.get("flight_number")) +logging.info("Airline (ICAO): %s", general.get("icao_airline")) +logging.info("Airlinename: %s", airline) +logging.info("Flugnummer: %s", general.get("flight_number")) -logging.info("Abflug ICAO: %s", origin.get("icao_code")) -logging.info("Abflugort: %s", origin_name) +logging.info("Abflug ICAO: %s", origin.get("icao_code")) +logging.info("Abflugort: %s", origin_name) -logging.info("Ziel ICAO: %s", dest.get("icao_code")) -logging.info("Zielort: %s", dest_name) +logging.info("Ziel ICAO: %s", dest.get("icao_code")) +logging.info("Zielort: %s", dest_name) +logging.info("Route: %s", route) -logging.info("Geplante Blockzeit: %s", block) -logging.info("Geplanter Start: %s UTC", start_time) -logging.info("Geplante Landung: %s UTC", land_time) +logging.info("Geplante Blockzeit: %s", block) +logging.info("Geplanter Start: %s UTC", start_time) +logging.info("Geplante Landung: %s UTC", land_time) -logging.info("Fluggerät: %s (%s)", aircraft_icao, aircraft_name) -logging.info("Cruiselevel: FL%s", fl) -logging.info("Entfernung: %s nm", distance) +logging.info("Fluggerät: %s (%s)", aircraft_icao, aircraft_name) +logging.info("Cruiselevel: FL%s", fl) +logging.info("Entfernung: %s nm", distance) -logging.info("Fuel: %s kg", fuel) -logging.info("Passagiere: %s", pax) -logging.info("ZFW: %s kg", zfw) -logging.info("TOW: %s kg", tow) +logging.info("Fuel: %s kg", fuel) +logging.info("Passagiere: %s", pax) +logging.info("ZFW: %s kg", zfw) +logging.info("TOW: %s kg", tow) logging.info( "Wetter Abflug %s: %s",