Fazil Altinel
4 years ago
4 changed files with 48 additions and 10 deletions
@ -0,0 +1,33 @@ |
|||||
|
import configparser |
||||
|
import logging |
||||
|
|
||||
|
|
||||
|
def readConfigFile(filePath): |
||||
|
""" |
||||
|
Read config file |
||||
|
|
||||
|
Args: |
||||
|
filePath ([str]): path to config file |
||||
|
|
||||
|
Returns: |
||||
|
[Obj]: config object |
||||
|
""" |
||||
|
config = configparser.ConfigParser() |
||||
|
config.read(filePath) |
||||
|
return config |
||||
|
|
||||
|
|
||||
|
def setLogger(logFilePath): |
||||
|
""" |
||||
|
Set logger |
||||
|
|
||||
|
Args: |
||||
|
logFilePath ([str]): path to log file |
||||
|
|
||||
|
Returns: |
||||
|
[obj]: logger object |
||||
|
""" |
||||
|
logHandler = [logging.FileHandler(logFilePath), logging.StreamHandler()] |
||||
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s", handlers=logHandler) |
||||
|
logger = logging.getLogger() |
||||
|
return logger |
Loading…
Reference in new issue