Centralized logging facility for the Grid Building plugin. [b]Static singleton API (preferred):[/b] [codeblock] # Once, during plugin initialization: PlacementLogger.initialize(debug_settings) ## # Or push a scoped override for a sub-region (tests, plugins): PlacementLogger.push_scope(custom_logger) # ... do work ... PlacementLogger.pop_scope() # 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 global emitter by calling [method initialize] again at any point — that replaces the production root. For bounded overrides (a single test, a single plugin sub-region) prefer [method push_scope] / [method pop_scope] so the override auto-cleans when the scoped region exits. [b]Test isolation:[/b] Tests call [method push_scope] in before_test and [method pop_scope] in after_test to substitute the production emitter with a muted or spy logger for the duration of one test. Sequential GdUnit4 execution keeps the stack consistent across tests. [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 RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
push_scope | Method | |
pop_scope | Method | |
set_instance | Method | |
clear_instance | Method | |
ref | Property | |
obj | Property | |
initialize | Method | |
settings | Property | |
logger | Property | |
ds | Property | |
VERBOSE_MIN_INTERVAL_MS | Field | |
LogLevel | Field | Shorthand alias for levels to reduce verbosity at callsites |
create_with_injection | Method | |
logger | Property | |
issues | Property | |
debug | Method | |
logger | Property | |
trace | Method | |
logger | Property | |
info | Method | |
logger | Property | |
warn | Method | |
logger | Property | |
error | Method | |
logger | Property | |
verbose | Method | |
logger | 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 |