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 | |
from logging.handlers import RotatingFileHandler | |
def setup_logger(): | |
MAX_BYTES = 10000000 # Maximum size for a log file | |
BACKUP_COUNT = 9 # Maximum number of old log files | |
# The name should be unique, so you can get in in other places | |
# by calling `logger = logging.getLogger('com.dvnguyen.logger.example') | |
logger = logging.getLogger('com.dvnguyen.logger.example') |