Set logging to truncate log file automatically
This commit is contained in:
parent
5965afde9a
commit
d5d8ed607d
1 changed files with 2 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import ctypes
|
|||
import glob
|
||||
import json
|
||||
import logging
|
||||
from logging.handlers import RotatingFileHandler
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
|
@ -83,7 +84,7 @@ if not os.path.exists(LOG_DIR): # pragma: no cover
|
|||
# Setup logging.
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
logfile_handler = logging.FileHandler(LOGFILE)
|
||||
logfile_handler = RotatingFileHandler(LOGFILE, maxBytes=10_000_000, backupCount=0)
|
||||
log_formatter = logging.Formatter(
|
||||
"%(asctime)s %(levelname)s: %(message)s", datefmt="%m/%d/%Y %H:%M:%S"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue