Last active
August 23, 2020 12:35
-
-
Save royz/d62932ab1654993c54639dc9ff5a8844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sys | |
import logging | |
from logging.handlers import RotatingFileHandler | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s', | |
handlers=( | |
RotatingFileHandler( | |
filename='logs.log', | |
maxBytes=(1024 ** 3) / 2, # max log file size 512MB | |
backupCount=1, | |
), | |
logging.StreamHandler(sys.stdout) | |
) | |
) | |
logger = logging.getLogger() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment