Centralized logging facility for the Grid Building plugin. [b]Static singleton API (preferred):[/b] [codeblock] # Once, during plugin initialization: PlacementLogger.set_instance(logger) # Anywhere in the plugin — zero boilerplate, zero null checks: PlacementLogger.debug("msg") PlacementLogger.trace("msg") PlacementLogger.warn("msg") PlacementLogger.error("msg") [/codeblock] [b]Overriding the logger at game time:[/b] Game developers can replace the logger at any point by calling [method set_instance] with their own [PlacementLogger] instance. The static helpers automatically route through the current instance. [codeblock] # Replace with your own logger (e.g. with custom log_sink, different level): var my_logger := PlacementLogger.new(my_debug_settings) PlacementLogger.set_instance(my_logger) # Or disable all plugin logging: PlacementLogger.clear_instance() [/codeblock] [b]Test isolation:[/b] [codeblock] func before_test() -> void: PlacementLogger.set_instance(mock_logger) func after_test() -> void: PlacementLogger.clear_instance() [/codeblock] [b]Instance API (still available for backward compat):[/b] [code]logger.log_debug("msg")[/code] USAGE: Consider dropping log level on the PlacementDebugSettings if you are getting too many messages Responsibilities:
- Provide contextual logging (verbose, error, warning) integrated with plugin debug settings.
- Support dependency-injected configuration and throttled verbose output.
Source: addons/grid_placement/logging/placement_logger.gd
Syntax
class PlacementLogger extends PlacementInjectableMembers
| Name | Kind | Summary |
|---|---|---|
set_instance | Method | |
clear_instance | Method | |
debug | Method | |
trace | Method | |
info | Method | |
warn | Method | |
error | Method | |
verbose | Method | |
VERBOSE_MIN_INTERVAL_MS | Field | |
LogLevel | Field | Shorthand alias for levels to reduce verbosity at callsites |
create_with_injection | Method | |
debug_settings | Property | |
logger | Property | |
issues | Property | |
set_log_sink | Method | |
stack | Property | |
caller | Property | |
source | Property | |
function | Property | |
composite | Property | |
now_ms | Property | |
last_ms | Property | |
composite | Property | |
stack | Property | |
caller | Property | |
source | Property | |
function | Property | |
line | Property | |
file_name | Property | |
caller | Property | |
source | Property | |
function | Property | |
line | Property | |
file_name | Property | |
log_at | Method | |
context | Property | |
msg | Property | |
get_runtime_issues | Method | |
issues | Property | |
resolve_placement_dependencies | Method | |
is_level_enabled | Method | |
is_debug_enabled | Method | |
is_verbose_enabled | Method | |
is_trace_enabled | Method | |
c | Property | |
result | Property | |
log | Method | |
log_debug_lazy | Method | |
msg_formatted | Property | |
log_warning | Method | |
log_info | Method | |
log_error | Method | |
log_warnings | Method | |
log_issues | Method | |
log_verbose | Method | |
log_trace | Method | |
log_debug | Method | |
log_verbose_throttled | Method | |
caller_id | Property | |
key | Property | |
log_debug_throttled | Method | |
caller_id | Property | |
key | Property | |
log_trace_throttled | Method | |
caller_id | Property | |
key | Property | |
log_verbose_once | Method | |
caller_id | Property | |
key | Property | |
log_debug_once | Method | |
caller_id | Property | |
key | Property | |
log_trace_once | Method | |
caller_id | Property | |
key | Property | |
log_warning_once | Method | |
caller_id | Property | |
key | Property | |
log_error_once | Method | |
caller_id | Property |
Source
addons/grid_placement/logging/placement_logger.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs