min cost and logging

- added ability to have a minimum point cost so that we can filter games like 1P out
 - updated logging to log INFO to stdout and DEBUG to a debug.log file which gets rotated
This commit is contained in:
mcinj 2022-04-24 09:34:03 -04:00
parent 6e0474b7ed
commit 1e5dd1b717
5 changed files with 77 additions and 45 deletions

View file

@ -1,13 +1,20 @@
import logging
import sys
from logging.handlers import RotatingFileHandler
Log_Format = "%(levelname)s %(asctime)s - %(message)s"
# log info level logs to stdout and debug to debug file
logging.basicConfig(stream = sys.stdout,
filemode = "w",
format = Log_Format,
level = logging.INFO)
log_format = "%(levelname)s %(asctime)s - %(message)s"
logging.basicConfig(
handlers=[RotatingFileHandler('./debug.log', maxBytes=100000, backupCount=10)],
level=logging.DEBUG,
format=log_format)
stream = logging.StreamHandler()
stream.setLevel(logging.INFO)
stream_format = logging.Formatter(log_format)
stream.setFormatter(stream_format)
def get_logger(name):
return logging.getLogger(name)
l = logging.getLogger(name)
l.addHandler(stream)
return l