relancement cuisines Saclay et Meudon
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import os, logging
|
||||
|
||||
def setup_logger(filename: str):
|
||||
# si l'argument est un chemin absolu, on le respecte
|
||||
if os.path.isabs(filename):
|
||||
log_path = filename
|
||||
else:
|
||||
# ancien comportement (ex: /var/log/Cuisine_Saclay/<filename>)
|
||||
base = "/var/log/Cuisine_Saclay"
|
||||
os.makedirs(base, exist_ok=True)
|
||||
log_path = os.path.join(base, filename)
|
||||
|
||||
os.makedirs(os.path.dirname(log_path), exist_ok=True)
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
filename=log_path,
|
||||
format="%(asctime)s %(levelname)s %(message)s"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user