Skip to content

feat: log name wildcards #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions addons/mod_loader/api/log.gd
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,27 @@ static func _log(message: String, mod_name: String, log_type: String = "info", o
_write_to_log_file(log_entry.get_entry())


static func _is_mod_name_ignored(mod_name: String) -> bool:
static func _is_mod_name_ignored(mod_log_name: String) -> bool:
if not ModLoaderStore:
return false

var ignored_mod_names := ModLoaderStore.ml_options.ignored_mod_names_in_log as Array
var ignored_mod_log_names := ModLoaderStore.ml_options.ignored_mod_names_in_log as Array

if not ignored_mod_names.size() == 0:
if mod_name in ignored_mod_names:
return true
# No ignored mod names
if ignored_mod_log_names.size() == 0:
return false

# Directly match a full mod log name. ex: "ModLoader:Deprecated"
if mod_log_name in ignored_mod_log_names:
return true

# Match a mod log name with a wildcard. ex: "ModLoader:*"
for ignored_mod_name in ignored_mod_log_names:
if ignored_mod_name.ends_with("*"):
if mod_log_name.begins_with(ignored_mod_name.trim_suffix("*")):
return true

# No match
return false


Expand Down
2 changes: 1 addition & 1 deletion addons/mod_loader/mod_loader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ signal logged(entry)
signal current_config_changed(config)

# Prefix for this file when using mod_log or dev_log
const LOG_NAME := "ModLoader"
const LOG_NAME := "ModLoader:Loader"

# --- DEPRECATED ---
# UNPACKED_DIR was moved to ModLoaderStore.
Expand Down