more logging
This commit is contained in:
parent
5e198e2e9d
commit
3005228416
2 changed files with 5 additions and 4 deletions
|
@ -26,6 +26,7 @@ class Giveaway:
|
||||||
self.time_created_string = None
|
self.time_created_string = None
|
||||||
self.time_created_in_minutes = None
|
self.time_created_in_minutes = None
|
||||||
|
|
||||||
|
logger.debug(f"Giveaway html: {soup_item}")
|
||||||
icons = soup_item.select('a.giveaway__icon')
|
icons = soup_item.select('a.giveaway__icon')
|
||||||
self.steam_url = icons[0]['href']
|
self.steam_url = icons[0]['href']
|
||||||
self.steam_app_id = self.get_steam_app_id(self.steam_url)
|
self.steam_app_id = self.get_steam_app_id(self.steam_url)
|
||||||
|
|
|
@ -4,20 +4,20 @@ from logging.handlers import RotatingFileHandler
|
||||||
|
|
||||||
# log info level logs to stdout and debug to debug file
|
# log info level logs to stdout and debug to debug file
|
||||||
|
|
||||||
log_format = "%(levelname)s %(asctime)s - %(message)s"
|
debug_log_format = "%(levelname)s %(asctime)s - [%(filename)s:%(lineno)d] - %(message)s"
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
handlers=[RotatingFileHandler(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", maxBytes=500000, backupCount=10)],
|
handlers=[RotatingFileHandler(f"{os.getenv('BOT_CONFIG_DIR', './config')}/debug.log", maxBytes=500000, backupCount=10)],
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format=log_format)
|
format=debug_log_format)
|
||||||
|
|
||||||
console_output = logging.StreamHandler()
|
console_output = logging.StreamHandler()
|
||||||
console_output.setLevel(logging.INFO)
|
console_output.setLevel(logging.INFO)
|
||||||
console_format = logging.Formatter(log_format)
|
console_format = logging.Formatter(debug_log_format)
|
||||||
console_output.setFormatter(console_format)
|
console_output.setFormatter(console_format)
|
||||||
|
|
||||||
info_log_file = RotatingFileHandler(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", maxBytes=100000, backupCount=10)
|
info_log_file = RotatingFileHandler(f"{os.getenv('BOT_CONFIG_DIR', './config')}/info.log", maxBytes=100000, backupCount=10)
|
||||||
info_log_file.setLevel(logging.INFO)
|
info_log_file.setLevel(logging.INFO)
|
||||||
info_log_format = logging.Formatter(log_format)
|
info_log_format = logging.Formatter(debug_log_format)
|
||||||
info_log_file.setFormatter(info_log_format)
|
info_log_file.setFormatter(info_log_format)
|
||||||
|
|
||||||
logging.root.addHandler(console_output)
|
logging.root.addHandler(console_output)
|
||||||
|
|
Loading…
Reference in a new issue