Ensure FATAL logs always go through to console
parent
1a97a0a78e
commit
403ee0aed5
5
bots.py
5
bots.py
|
@ -36,7 +36,6 @@ logfile_path = config_data["logfile_path"]
|
|||
logfile = open(logfile_path, "a")
|
||||
if not config_data["log_to_terminal"] and not config_data["log_to_file"]:
|
||||
print(f"!!! WARNING !!! CONSOLE AND LOGFILE OUTPUT DISABLED !!!\n!!! NO LOGS WILL BE PROVIDED !!!")
|
||||
first_log_entry = True
|
||||
|
||||
###############################
|
||||
# Simple Logging System
|
||||
|
@ -62,7 +61,7 @@ def log(message, level="INFO", exec_info=False):
|
|||
if level not in log_levels:
|
||||
level = "INFO" # Default to INFO if an invalid level is provided
|
||||
|
||||
if level in config_data["log_levels"] or first_log_entry:
|
||||
if level in config_data["log_levels"] or level == "FATAL":
|
||||
elapsed = time.time() - globals.get_bot_start_time()
|
||||
uptime_str, _ = utility.format_uptime(elapsed)
|
||||
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
@ -73,7 +72,7 @@ def log(message, level="INFO", exec_info=False):
|
|||
log_message += f"\n{traceback.format_exc()}"
|
||||
|
||||
# Print to terminal if enabled
|
||||
if config_data["log_to_terminal"]:
|
||||
if config_data["log_to_terminal"] or level == "FATAL":
|
||||
print(log_message)
|
||||
|
||||
# Write to file if enabled
|
||||
|
|
Loading…
Reference in New Issue