22 lines
627 B
Python
22 lines
627 B
Python
#. -*- coding: utf-8
|
|
#
|
|
# ioconfig.py - read/write config/log etc.
|
|
|
|
import configparser
|
|
import logging
|
|
|
|
""" config reader """
|
|
parser = configparser.ConfigParser()
|
|
parser.read('config.ini')
|
|
|
|
""" log writer """
|
|
logger = logging.getLogger('proxmaster')
|
|
logging.captureWarnings(True)
|
|
logger.setLevel(logging.DEBUG)
|
|
handler = logging.FileHandler(parser.get('general', 'logfile'))
|
|
handler.setLevel(logging.DEBUG)
|
|
#formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
|
|
handler.setFormatter(formatter)
|
|
logger.addHandler(handler)
|