-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
27 lines (22 loc) · 761 Bytes
/
Copy pathlogger.py
File metadata and controls
27 lines (22 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Logging centralizado. INFO en producción, DEBUG si LOG_LEVEL=DEBUG en env.
Streamlit Cloud captura stdout/stderr — visible en Manage App → Logs.
"""
import logging
import os
import sys
def setup() -> None:
level_name = os.environ.get("LOG_LEVEL", "INFO").upper()
level = getattr(logging, level_name, logging.INFO)
logging.basicConfig(
stream=sys.stderr,
level=level,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
datefmt="%H:%M:%S",
force=True,
)
# Silenciar librerías ruidosas
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("playwright").setLevel(logging.WARNING)
def get(name: str) -> logging.Logger:
return logging.getLogger(name)