nileshhanotia commited on
Commit
b23b96d
1 Parent(s): 615a0de

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +16 -0
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