fix logging to use the new

This commit is contained in:
2025-07-27 17:56:57 +02:00
parent 287d2de81e
commit cee070d237
6 changed files with 35 additions and 34 deletions

View File

@@ -72,7 +72,7 @@ async def send_elab_csv_to_customer(cfg: dict, id: int, unit: str, tool: str, cs
send_ftp_info = await cur.fetchone()
logger.info(f"id {id} - {unit} - {tool}: estratti i dati per invio via ftp")
except Exception as e:
logging.error(f"id {id} - {unit} - {tool} - errore nel query per invio ftp: {e}")
logger.error(f"id {id} - {unit} - {tool} - errore nel query per invio ftp: {e}")
try:
# Converti in bytes
@@ -95,17 +95,17 @@ async def send_elab_csv_to_customer(cfg: dict, id: int, unit: str, tool: str, cs
result = ftp.storbinary(f'STOR {send_ftp_info["ftp_filename"]}', csv_buffer)
if result.startswith('226'):
logging.info(f"File {send_ftp_info["ftp_filename"]} inviato con successo")
logger.info(f"File {send_ftp_info["ftp_filename"]} inviato con successo")
return True
else:
logging.error(f"Errore nell'invio: {result}")
logger.error(f"Errore nell'invio: {result}")
return False
except all_errors as e:
logging.error(f"Errore FTP: {e}")
logger.error(f"Errore FTP: {e}")
return False
except Exception as e:
logging.error(f"Errore generico: {e}")
logger.error(f"Errore generico: {e}")
return False
finally:
csv_buffer.close()