Created
September 13, 2019 06:52
-
-
Save khiemdoan/c4739b536dd2a03654a445929144f059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import logging.handlers | |
from pathlib import Path | |
from utils import Filesystem | |
__author__ = 'KhiemDH' | |
__github__ = 'https://github.com/khiemdoan' | |
__email__ = '[email protected]' | |
def setup(): | |
parent = Path(__file__).parent | |
Filesystem.mkdirs(parent) | |
log_file = str(Path(parent, 'log.log').absolute()) | |
handler = logging.handlers.RotatingFileHandler(log_file, maxBytes=2000000, backupCount=5, encoding='utf-8') | |
formater = logging.Formatter('%(asctime)s - %(module)s - %(funcName)s: [%(levelname)s] %(message)s') | |
handler.setFormatter(formater) | |
logger = logging.getLogger() | |
logger.addHandler(handler) | |
logger.setLevel(logging.INFO) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment