Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit b005cc3

Browse files
committed
Improved logger
Signed-off-by: Cédric Foellmi <[email protected]>
1 parent 24fe329 commit b005cc3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

oort/common/logger.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
2+
from datetime import datetime
23
from logging import DEBUG, FileHandler, Formatter, INFO, Logger, StreamHandler, getLogger
3-
4-
from .config import Config
4+
from pathlib import Path
55

66

77
def get_oort_logger(debug=False) -> Logger:
@@ -13,7 +13,8 @@ def get_oort_logger(debug=False) -> Logger:
1313
formatter = Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
1414

1515
if os.environ.get('OORT_TESTS') != '1':
16-
file_handler = FileHandler(Config.log_file_path())
16+
log_file_path = Path(f'oort_{datetime.now().replace(microsecond=0).isoformat()}.log')
17+
file_handler = FileHandler(log_file_path)
1718
file_handler.setLevel(DEBUG if debug else INFO)
1819
file_handler.setFormatter(formatter)
1920
logger.addHandler(file_handler)

0 commit comments

Comments
 (0)