diff --git a/.gitignore b/.gitignore index 06d6f07..00990e0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ database/automod.json database/isobank/* *.log *.pyc +logs/currency.log +logs/error-log.txt +logs/info-log.txt +logs/startup-log.txt __pycache__ *.bak venv diff --git a/logs/currency.log b/logs/currency.log deleted file mode 100644 index e69de29..0000000 diff --git a/logs/error-log.txt b/logs/error-log.txt deleted file mode 100644 index 7809b0e..0000000 --- a/logs/error-log.txt +++ /dev/null @@ -1 +0,0 @@ -#All exceptions will be logged here! diff --git a/logs/info-log.txt b/logs/info-log.txt deleted file mode 100644 index d129abc..0000000 --- a/logs/info-log.txt +++ /dev/null @@ -1 +0,0 @@ -#All information and warnings will be logged here! diff --git a/logs/startup-log.txt b/logs/startup-log.txt deleted file mode 100644 index e69de29..0000000 diff --git a/main.py b/main.py index 4710932..eda162f 100644 --- a/main.py +++ b/main.py @@ -44,19 +44,30 @@ def initial_setup(): except IOError as e: logger.error(f"Failed to make database file: {e}", module="main/Setup") try: if not os.path.isfile("logs/info-log.txt"): - open('logs/info-log.txt', 'x', encoding="utf-8") + with open('logs/info-log.txt', 'x', encoding="utf-8") as this: + this.write("#All information and warnings will be logged here!\n") + this.close() logger.info("Created info log", module="main/Setup", nolog=True) time.sleep(0.5) if not os.path.isfile("logs/error-log.txt"): - open('logs/error-log.txt', 'x', encoding="utf-8") + with open('logs/error-log.txt', 'x', encoding="utf-8") as this: + this.write("#All exceptions will be logged here!\n") + this.close() logger.info("Created error log", module="main/Setup", nolog=True) time.sleep(0.5) if not os.path.isfile("logs/currency.log"): - open('logs/currency.log', 'x', encoding="utf-8") + with open('logs/currency.log', 'x', encoding="utf-8") as this: + this.close() logger.info("Created currency log", module="main/Setup", nolog=True) time.sleep(0.5) + if not os.path.isfile("logs/startup-log.txt"): + with open("logs/startup-log.txt", 'x', encoding="utf-8") as this: + this.close() + time.sleep(0.5) except IOError as e: logger.error(f"Failed to make log file: {e}", module="main/Setup", nolog=True) +initial_setup() # Check for any missing sub-directories or databases in bot directory + # Framework Module Loader colors = colors.Colors() s = logger.StartupLog("logs/startup-log.txt", clear_old_logs=True) @@ -379,7 +390,6 @@ async def credits(ctx: ApplicationContext): await ctx.respond(embed=localembed) # Initialization -initial_setup() # Check for any missing sub-directories or databases in bot directory active_cogs = [ "economy", "maths",