Moved the builder, tagger, and setup modules into their own folders, along with constants to help provide better clarity and readability. Additionally added a missing call for the tag_for_artifcact_triggers() function

This commit is contained in:
mwisnowski 2025-01-28 10:19:44 -08:00
parent 3a5beebfe2
commit dbbc8bc66e
20 changed files with 1525 additions and 1737 deletions

29
code/logging_util.py Normal file
View file

@ -0,0 +1,29 @@
from __future__ import annotations
from settings import os
import logging
# Create logs directory if it doesn't exist
if not os.path.exists('logs'):
os.makedirs('logs')
# Logging configuration
LOG_DIR = 'logs'
LOG_FILE = os.path.join(LOG_DIR, 'deck_builder.log')
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
LOG_LEVEL = logging.INFO
# Create formatters and handlers
# Create a formatter that removes double underscores
class NoDunderFormatter(logging.Formatter):
def format(self, record):
record.name = record.name.replace("__", "")
return super().format(record)
# File handler
file_handler = logging.FileHandler(LOG_FILE, mode='w', encoding='utf-8')
file_handler.setFormatter(NoDunderFormatter(LOG_FORMAT))
# Stream handler
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(NoDunderFormatter(LOG_FORMAT))