Misc cleaning

This commit is contained in:
Adrien Ufferte
2025-08-18 12:00:17 +02:00
parent 620df86198
commit 134930d7c6
6 changed files with 10 additions and 10 deletions
@@ -5,7 +5,7 @@ class_name ValidatorFunctions
static func matches(pattern: String, text: String) -> bool:
var regex = RegEx.create_from_string(pattern)
if not regex.is_valid():
Logger.debug("ValidatorFunctions: Invalid RegEx pattern supplied to matches function: %s" % pattern)
Logger.error("ValidatorFunctions: Invalid RegEx pattern supplied to matches function: %s" % pattern)
return false
var result = regex.search(text)
return result != null and result.strings.size() > 0
@@ -14,7 +14,7 @@ static func matches(pattern: String, text: String) -> bool:
static func does_not_match(pattern: String, text: String) -> bool:
var regex = RegEx.create_from_string(pattern)
if not regex.is_valid():
Logger.debug("ValidatorFunctions: Invalid RegEx pattern supplied to does_not_match function: %s" % pattern)
Logger.error("ValidatorFunctions: Invalid RegEx pattern supplied to does_not_match function: %s" % pattern)
return false
var result = regex.search(text)
return result == null
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7 -7
View File
@@ -31,9 +31,9 @@ func _ready() -> void:
func delete_old_logs(days_threshold: float = 10) -> void:
var dir: DirAccess = DirAccess.open(LOG_PATH)
var error: Error = DirAccess.get_open_error()
if error != OK:
push_error("Logger: Could not open Logs directory for cleanup. Error: %s" % error_string(error))
var err: Error = DirAccess.get_open_error()
if err != OK:
push_error("Logger: Could not open Logs directory for cleanup. Error: %s" % error_string(err))
return
if not dir:
push_warning("Logger: Could not open Logs directory for cleanup.")
@@ -58,7 +58,7 @@ func delete_old_logs(days_threshold: float = 10) -> void:
var age_days: float = float(now - file_time) / (60.0 * 60.0 * 24.0)
if age_days > days_threshold:
var full_path: String = LOG_PATH + file_name
var err: Error = dir.remove(full_path)
err = dir.remove(full_path)
if err != OK:
push_warning("Logger: Failed to delete old log: " + full_path)
else:
@@ -80,9 +80,9 @@ func _init_log_file() -> void:
log_file_path = LOG_PATH + filename
log_file = FileAccess.open(log_file_path, FileAccess.WRITE)
var error: Error = FileAccess.get_open_error()
if error != OK:
push_error("Logger: Load external sound: Cannot open file %s. Error: %s" % [log_file_path, error_string(error)])
var err: Error = FileAccess.get_open_error()
if err != OK:
push_error("Logger: Load external sound: Cannot open file %s. Error: %s" % [log_file_path, error_string(err)])
return
if log_file == null:
push_error("Logger: Could not open log file at " + log_file_path)
+1 -1
View File
@@ -169,7 +169,7 @@ func safe_load_and_fix_resource(path: String, old_texts: Array[String], new_text
for index: int in range(old_texts.size()):
if content.find(old_texts[index]) != -1:
Logger.info("UserDataManager: Fix resource:" + path)
Logger.trace("UserDataManager: Fix resource:" + path)
content = content.replace(old_texts[index], new_texts[index])
var file: FileAccess = FileAccess.open(path, FileAccess.WRITE)
var error: Error = FileAccess.get_open_error()