Skip to content

Commit

Permalink
FIX: Log dir search algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
KOOKIIEStudios committed Nov 11, 2023
1 parent ff280a7 commit e61b15f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@
# Use a config file for these, in larger projects:
LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
FORMATTER = logging.Formatter(LOG_FORMAT)
LOG_DIR = Path("logs")
LOG_FOLDER_NAME = "logs"
LOG_DIR = Path.cwd() / LOG_FOLDER_NAME
LOG_DIR_ALT = Path.cwd().parent / LOG_FOLDER_NAME
ACTIVE_LOG_NAME = "logger.log"


def get_log_path():
if LOG_DIR.exists():
return Path(LOG_DIR, ACTIVE_LOG_NAME)
elif LOG_DIR_ALT.exists():
return Path(LOG_DIR_ALT, ACTIVE_LOG_NAME)
raise FileNotFoundError(2, "Log output directory could not be found!")


Expand Down

0 comments on commit e61b15f

Please sign in to comment.