Skip to content

Commit

Permalink
bugifx - fixed logging bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
OcelotWalrus committed Jan 14, 2024
1 parent d9d13fb commit 2e2a8eb
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions source/logger_sys.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
import logging
import os
import appdirs
from datetime import date
from datetime import *

def log_message(message):
program_dir = str(appdirs.user_config_dir(appname='Bane-Of-Wargs'))

# Create log file
with open(f'{program_dir}/logs/{date.today()}.log', 'w') as f:
f.write("LOG")

# Create and configure logger
logging.basicConfig(filename=f'{program_dir}/logs/{date.today()}.log',
format='%(asctime)s %(message)s',
filemode='w'
)


# Let us create an object
logger = logging.getLogger()

logger.warning(message)
with open(f'{program_dir}/logs/{date.today()}.log', 'a') as f:
f.write(f'{datetime.now()}: {message}\n')

0 comments on commit 2e2a8eb

Please sign in to comment.