ItemVaultLogger — static-singleton plugin log facade. One per plugin (one static class). Any addon script routes runtime output through [method ItemVaultLogger.error], [method ItemVaultLogger.warn], or [method ItemVaultLogger.info] instead of Godot's push_error / push_warning so the game can redirect, filter, or suppress it. Games inject their own [ItemVaultLogSink] via [method set_log_sink] at boot. Default behavior (no injection): routes through Godot's push_error / push_warning / print so existing editor + stderr output is preserved. Pattern: static singleton, not per-instance injection. Reasons:
- Plugins shouldn't need to wire a logger into every script (refcounts, save/load, validators, services, etc.).
- Games boot the plugin once and set the sink once — every subsequent
ItemVaultLogger.warn(...)call lands on the game's destination. - Keeps call sites close to plain
push_warning:ItemVaultLogger.warn( "InventorySave", "schema mismatch")vspush_warning("..."). No new constructor parameters, no scene wiring. Usage: # In your game's bootstrap, keep a strong owner for the sink. var _item_vault_log_sink := MyGameLogSink.new() ItemVaultLogger.set_log_sink(_item_vault_log_sink) # Anywhere in the addon: ItemVaultLogger.error("InventorySave", "version mismatch") ItemVaultLogger.warn("MoveOnSpawn", "missing settings, skipping") Addon runtime code should call this facade, not Godot logging directly. The default sink preserves editor/stderr output when no game sink is installed.
Source: addons/item_vault/logging/item_vault_logger.gd
Syntax
class ItemVaultLogger extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
set_log_sink | Method | |
clear_log_sink | Method | |
get_log_sink | Method | |
resolved | Property | |
error | Method | |
warn | Method | |
info | Method | |
error | Method | |
warn | Method | |
info | Method |