se migran los print de los módulos a logging con nivel explícito
pipeline_utils.log pasa a usar logging (parámetro severity) y los print de pipeline, sapb1_manager, hana_manager, outlook_utilities, email_utilities y main pasan a logger.info/warning/error, de modo que LOG_LEVEL filtre por severidad. El texto del log no cambia. Se mantienen los print de CLI en sunat_schema (__main__), tools/ y tests/. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ef9c90fc0
commit
3fa26e3ef6
11 files changed
+109
-79
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import msal
|
||||
import requests
|
||||
import warnings
|
||||
@@ -5,6 +6,8 @@ import base64
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
from dotenv import load_dotenv
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
# ============================================================================
|
||||
@@ -214,7 +217,7 @@ def send_email(access_token: str, from_email: str, to_recipients: list[str], sub
|
||||
"contentBytes": encoded_content
|
||||
})
|
||||
else:
|
||||
print(f"Advertencia: El archivo no existe y no se adjuntará: {path}")
|
||||
logger.warning(f"Advertencia: El archivo no existe y no se adjuntará: {path}")
|
||||
|
||||
# Estructura del mensaje para la API
|
||||
email_data = {
|
||||
@@ -234,13 +237,13 @@ def send_email(access_token: str, from_email: str, to_recipients: list[str], sub
|
||||
try:
|
||||
response = requests.post(url, headers=headers, json=email_data, verify=verify_ssl)
|
||||
if response.status_code == 202:
|
||||
print(f" ├── SUCCESS: Correo enviado exitosamente a: {', '.join(to_recipients)}")
|
||||
logger.info(f" ├── SUCCESS: Correo enviado exitosamente a: {', '.join(to_recipients)}")
|
||||
return True
|
||||
else:
|
||||
print(f" ├── ERROR: Al enviar correo: {response.status_code} - {response.text}")
|
||||
logger.error(f" ├── ERROR: Al enviar correo: {response.status_code} - {response.text}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f" ├── ERROR: Excepcion al enviar correo: {e}")
|
||||
logger.error(f" ├── ERROR: Excepcion al enviar correo: {e}")
|
||||
return False
|
||||
|
||||
# ============================================================================
|
||||
Reference in new issue
Block a user