Spaces:
Build error
Build error
Rohit Diwane
commited on
Commit
·
78cdb5a
1
Parent(s):
f38ba85
Create logger.py
Browse files
logger.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
import os
|
3 |
+
from datetime import datetime
|
4 |
+
|
5 |
+
LOG_FILE=f"{datetime.now().strftime('%m_%d_%Y_%H_%M_%S')}.log"
|
6 |
+
|
7 |
+
log_path=os.path.join(os.getcwd(),"logs")
|
8 |
+
|
9 |
+
os.makedirs(log_path,exist_ok=True)
|
10 |
+
|
11 |
+
LOG_FILEPATH=os.path.join(log_path,LOG_FILE)
|
12 |
+
|
13 |
+
|
14 |
+
logging.basicConfig(level=logging.INFO,
|
15 |
+
filename=LOG_FILEPATH,
|
16 |
+
format="[%(asctime)s] %(lineno)d %(name)s - %(levelname)s - %(message)s"
|
17 |
+
)
|