You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
684 B
33 lines
684 B
4 years ago
|
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
|