mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
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:
parent
3a5beebfe2
commit
dbbc8bc66e
20 changed files with 1525 additions and 1737 deletions
29
code/logging_util.py
Normal file
29
code/logging_util.py
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue