1234567891011121314 |
- import os
- from datetime import datetime
- import logging
- def create_logger():
- now = datetime.now()
- file_log = os.path.join(os.path.dirname(__file__), F'logs_{now.year}{now.month}{now.day}.log')
- print(file_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__)
|