12345678910111213141516171819202122 |
- import logging
- # import logging.config
- import os
- from datetime import datetime
- import appdirs
- def create_logger():
-
- path_dir_log = os.path.join(appdirs.user_log_dir(), 'propusk')
- if not os.path.exists(path_dir_log):
- os.mkdir(path_dir_log)
- now = datetime.now()
- file_log = os.path.join(path_dir_log, F'logs_{now.year}{now.month}{now.day}.log')
- logging.basicConfig(filename=file_log,
- encoding='utf-8',
- level=logging.DEBUG,
- format='%(asctime)s %(name)s %(levelname)s %(message)s')
- # logging.config.fileConfig('logger.conf')
- logger = logging.getLogger('PropuskLogger')
|