Skip to content

Class

PlacementLogger

Generated GDScript class reference for GridPlacement.PlacementLogger.

Status
Current
Version
v6.0
Source updated
Active v6.0 guide line from Grid Placement repo
Generated on
2026-09-01

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 RefCounted

Members

NameKindSummary
push_scopeMethod
pop_scopeMethod
set_instanceMethod
clear_instanceMethod
initializeMethod
VERBOSE_MIN_INTERVAL_MSField
LogLevelFieldShorthand alias for levels to reduce verbosity at callsites
create_with_injectionMethod
debugMethod
traceMethod
infoMethod
warnMethod
errorMethod
verboseMethod
set_log_sinkMethod
log_atMethod
LOG_MAP_CAPFieldCap the per-(sender,key) throttle/once dictionaries so long sessions with many placed objects don't leak memory. Entries are evicted in insertion order (GDScript Dictionary preserves it) once the cap is exceeded.
get_runtime_issuesMethod
resolve_placement_dependenciesMethod
is_level_enabledMethod
is_debug_enabledMethod
is_verbose_enabledMethod
is_trace_enabledMethod
logMethod
log_debug_lazyMethod
log_warningMethod
log_infoMethod
log_errorMethod
log_warningsMethod
log_issuesMethod
log_verboseMethod
log_traceMethod
log_debugMethod
log_verbose_throttledMethod
log_debug_throttledMethod
log_trace_throttledMethod
log_verbose_onceMethod
log_debug_onceMethod
log_trace_onceMethod
log_warning_onceMethod
log_error_onceMethod
log_info_onceMethod
get_debug_settingsMethod
set_log_levelMethod