ModLoaderLog🔗
Inherits: Object
This Class provides methods for logging, retrieving logged data, and internal methods for working with log files.
Constants🔗
• MOD_LOG_PATH
: "user://logs/modloader.log"
🔗
• ERROR
: 0
🔗
• WARNING
: 1
🔗
• INFO
: 2
🔗
• DEBUG
: 3
🔗
Properties🔗
• logged_messages
🔗
• verbosity
🔗
• ignored_mods
🔗
• hint_color
🔗
Method Descriptions🔗
• void fatal(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the error in red and a stack trace. Prefixed FATAL-ERROR.
Always logged.
Parameters:🔗
message
(String
): The message to be logged as an error.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
Breakpoint
Stops execution in the editor, use this when something really needs to be fixed.
• void error(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message and pushes an error. Prefixed ERROR.
Always logged.
Parameters:🔗
message
(String
): The message to be logged as an error.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void warning(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message and pushes a warning. Prefixed WARNING.
Logged with verbosity level at or above warning (-v
or --log-warning
).
Parameters:🔗
message
(String
): The message to be logged as a warning.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void info(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message. Prefixed INFO.
Logged with verbosity level at or above info (-vv
or --log-info
).
Parameters:🔗
message
(String
): The message to be logged as an information.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void success(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message. Prefixed SUCCESS.
Logged with verbosity level at or above info (-vv
or --log-info
).
Parameters:🔗
message
(String
): The message to be logged as a success.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void debug(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message. Prefixed DEBUG.
Logged with verbosity level at or above debug (-vvv
or --log-debug
).
Parameters:🔗
message
(String
): The message to be logged as a debug.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void hint(message: String, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message. Prefixed HINT and highligted.
Logged with verbosity level at or above debug (-vvv
or --log-debug
) and in the editor only. Not written to mod loader log.
Note
Use this to help other developers debug issues by giving them error-specific hints.
Parameters:🔗
message
(String
): The message to be logged as a debug.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• void debug_json_print(message: String, json_printable: Variant, mod_name: String, only_once: bool)
static🔗
Description:🔗
Logs the message formatted with JSON.print()
. Prefixed DEBUG.
Logged with verbosity level at or above debug (-vvv
or --log-debug
).
Parameters:🔗
message
(String
): The message to be logged as a debug.
json_printable
(Variant): The variable to be formatted and printed using JSON.print()
.
mod_name
(String
): The name of the mod or ModLoader class associated with this log entry.
only_once
(bool
): (Optional) If true, the log entry will only be logged once, even if called multiple times. Default is false.
Returns:
- No return value
• Array
get_all_as_resource()
static🔗
Description:🔗
Returns an array of log entries as a resource.
Returns:
Array
: An array of log entries represented as resource.
• Array
get_all_as_string()
static🔗
Description:🔗
Returns an array of log entries as a string.
Returns:
Array
: An array of log entries represented as strings.
• Array
get_by_mod_as_resource(mod_name: String)
static🔗
Description:🔗
Returns an array of log entries as a resource for a specific mod_name.
Parameters:🔗
mod_name
(String
): The name of the mod or ModLoader class associated with the log entries.
Returns:
Array
: An array of log entries represented as resource for the specifiedmod_name
.
• Array
get_by_mod_as_string(mod_name: String)
static🔗
Description:🔗
Returns an array of log entries as a string for a specific mod_name.
Parameters:🔗
mod_name
(String
): The name of the mod or ModLoader class associated with the log entries.
Returns:
Array
: An array of log entries represented as strings for the specifiedmod_name
.
• Array
get_by_type_as_resource(type: String)
static🔗
Description:🔗
Returns an array of log entries as a resource for a specific type.
Parameters:🔗
type
(String
): The log type associated with the log entries.
Returns:
Array
: An array of log entries represented as resource for the specifiedtype
.
• Array
get_by_type_as_string(type: String)
static🔗
Description:🔗
Returns an array of log entries as a string for a specific type.
Parameters:🔗
type
(String
): The log type associated with the log entries.
Returns:
Array
: An array of log entries represented as strings for the specifiedtype
.
• Array
get_all()
static🔗
Description:🔗
Returns an array of all log entries.
Returns:
Array
: An array of all log entries.
• Array
get_by_mod(mod_name: String)
static🔗
Description:🔗
Returns an array of log entries for a specific mod_name.
Parameters:🔗
mod_name
(String
): The name of the mod or ModLoader class associated with the log entries.
Returns:
Array
: An array of log entries for the specifiedmod_name
.
• Array
get_by_type(type: String)
static🔗
Description:🔗
Returns an array of log entries for a specific type.
Parameters:🔗
type
(String
): The log type associated with the log entries.
Returns:
Array
: An array of log entries for the specifiedtype
.
• Array
get_all_entries_as_string(log_entries: Array)
static🔗
Description:🔗
Returns an array of log entries represented as strings.
Parameters:🔗
log_entries
(Array
): An array of ModLoaderLogEntry Objects.
Returns:
Array
: An array of log entries represented as strings.