12345678910111213 |
- import os, sys
- from datetime import datetime
- import logging
- def create_logger():
- now = datetime.now()
- file_log = os.path.join(os.path.dirname(sys.argv[0]), 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')
-
- logger = logging.getLogger(__name__)
|