extends Node var mutex: Mutex = Mutex.new() # Used for errors. func error(message: String, alert_message: String) -> void: mutex.lock() if message == "": message = "Empty message string passed to an error message!" if Game.logmode >= 1: printerr("[ERROR] " + message) OS.alert(alert_message, "Error!") if OS.shell_open(OS.get_user_data_dir()) != OK: Log.warning("Couldn't open file explorer!") else: OS.alert("An error has occurred. The program will now exit.", "Error!") get_tree().quit() mutex.unlock() # Used for warnings. func warning(message: String) -> void: mutex.lock() if message == "": message = "Empty message string passed to a warning message!" if Game.logmode >= 2: printerr("[WARNING] " + message) mutex.unlock() # Used for simple info. func info(message: String) -> void: mutex.lock() if message == "": warning("Empty message string passed to an info message!") mutex.unlock() return if Game.logmode >= 3: print("[INFO] " + message) mutex.unlock() # Used for debugging. func debug(message: String) -> void: mutex.lock() if message == "": warning("Empty message string passed to a debug message!") mutex.unlock() return if Game.logmode >= 4: print("[DEBUG] " + message) mutex.unlock()