2023-03-12 13:03:58 +00:00
|
|
|
from files.helpers.config.const import *
|
2022-11-30 18:09:31 +00:00
|
|
|
|
2023-07-30 00:42:06 +00:00
|
|
|
def log_file(log_str, log_filename="rdrama.log"):
|
2022-11-30 18:09:31 +00:00
|
|
|
'''
|
|
|
|
Simple method to log a string to a file
|
|
|
|
'''
|
|
|
|
log_target = f"{LOG_DIRECTORY}/{log_filename}"
|
|
|
|
try:
|
|
|
|
with open(log_target, "a", encoding="utf-8") as f:
|
2022-11-30 18:49:22 +00:00
|
|
|
f.write(log_str + '\n')
|
2022-11-30 18:09:31 +00:00
|
|
|
except Exception as e:
|
|
|
|
print(f"Failed to log to file {log_target} due to {e.__class__.__name__}")
|