zmieniono print na logging

zmieniono wyjscie cron z pliku na stdout i stderr
This commit is contained in:
2025-11-03 09:05:45 +01:00
parent 85377e9e1a
commit 820db917ce
6 changed files with 39 additions and 29 deletions

View File

@@ -1,4 +1,5 @@
import re
import logging
def normalize(text):
if not text:
@@ -63,20 +64,20 @@ def process_row(row, mayo, counter):
if not link:
return None
print(f"\n🔗 Sprawdzam: {link}")
logging.info(f"\n🔗 Sprawdzam: {link}")
try:
info = mayo.get_order_info(link)
order_number = info["order_number"]
model = info["model"]
print(f"Nr z arkusza: {nr_zam}")
print(f"Nr ze strony: {order_number}")
print(f"Model: {model}")
logging.info(f"Nr z arkusza: {nr_zam}")
logging.info(f"Nr ze strony: {order_number}")
logging.info(f"Model: {model}")
if normalize(order_number) == normalize(nr_zam):
print("✅ Numer się zgadza")
logging.info("✅ Numer się zgadza")
else:
print("⚠️ Numer NIE pasuje!")
logging.warning("⚠️ Numer NIE pasuje!")
row_data = [
counter,
@@ -91,11 +92,11 @@ def process_row(row, mayo, counter):
info.get("finish_kc"),
info.get("finish_s"),
]
print(f"raw_data: {row_data}")
logging.debug(f"raw_data: {row_data}")
return row_data
except Exception as e:
print(f"❌ Błąd podczas przetwarzania linku {link}: {e}")
logging.error(f"❌ Błąd podczas przetwarzania linku {link}: {e}")
return None
def process_all_rows(rows, mayo):