Chris' Tutorials
Docs/Grid Placement

Class

PlacementGodotLoggerSink

Generated GDScript class reference for GridPlacement.PlacementGodotLoggerSink.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.

Source: addons/grid_placement/logging/placement_godot_logger_sink.gd

Syntax

class PlacementGodotLoggerSink extends RefCounted

Members

NameKindSummary
LogLevelFieldOpt-in bridge that funnels [PlacementLogger] output through the engine's [method @GlobalScope.push_error] / [method @GlobalScope.push_warning] so a host game's [Logger] (registered via [method OS.add_logger]) can capture it. [b]Why this exists.[/b] [PlacementLogger._emit_log] sends ERROR to [method @GlobalScope.push_error] and WARNING to [method @GlobalScope.push_warning] (both catchable by a [Logger] subclass) but emits INFO/DEBUG/VERBOSE/TRACE via raw [method @GlobalScope.print], which a [Logger] subclass cannot see. A game that wants every plugin log line in one structured drain therefore has no hook for the lower five levels. This sink closes that gap: it installs itself as the [PlacementLogger] log-sink [Callable], so every plugin log call routes here first, and re-emits it as an engine warning/error that the game's [Logger] then captures. [b]Level mapping[/b] (matches the host-side documentation in Moonbark's [code]game_runtime.gd[/code]): - [code]ERROR[/code] → [method @GlobalScope.push_error] - [code]WARNING / INFO / DEBUG / VERBOSE / TRACE[/code] → [method @GlobalScope.push_warning] Collapsing the lower five onto WARNING is deliberate: the engine only offers two catchable severities, and surfacing plugin INFO/DEBUG as a warning keeps it visible in the host's JSONL rather than lost on stdout. The host can still distinguish them via the message text. [b]Lifecycle.[/b] [codeblock] var sink := PlacementGodotLoggerSink.new() if not sink.install(): # PlacementLogger has no active instance yet — retry after the # plugin (e.g. BuildManager) has constructed its logger. pass ... sink.uninstall() # restore PlacementLogger's default print/push routing [/codeblock] Installing replaces any existing [PlacementLogger] sink; [method uninstall] clears it back to the default routing. Keep a reference to the instance for the lifetime of the bridge — being a [RefCounted], it frees (and the bridge stops) once the last reference drops.
installMethod
loggerProperty
uninstallMethod
loggerProperty
formattedProperty

Source

addons/grid_placement/logging/placement_godot_logger_sink.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs