Spaces:
Build error
Build error
nileshhanotia
commited on
Commit
•
b23b96d
1
Parent(s):
615a0de
Create utils.py
Browse files
utils.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
from config.settings import LOG_LEVEL
|
3 |
+
|
4 |
+
def setup_logger(name):
|
5 |
+
logger = logging.getLogger(name)
|
6 |
+
logger.setLevel(LOG_LEVEL)
|
7 |
+
|
8 |
+
if not logger.handlers:
|
9 |
+
handler = logging.StreamHandler()
|
10 |
+
formatter = logging.Formatter(
|
11 |
+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
12 |
+
)
|
13 |
+
handler.setFormatter(formatter)
|
14 |
+
logger.addHandler(handler)
|
15 |
+
|
16 |
+
return logger
|