Skip to content

GBLogger

Centralized logging facility for the Grid Building plugin.

USAGE: Consider dropping log level on the GBDebugSettings 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.

static func create_with_injection( container: GBCompositionContainer ) -> GBLogger

Creates a GBLogger with dependency injection from container.

func set_log_sink( p_sink: Callable ) -> void
func _get_caller_id( ) -> String

Helper to get caller identifier from stack

func _is_throttled( caller_id: String, key: String ) -> bool

Helper to check if logging should be throttled

func _should_log_once( caller_id: String, key: String, once_dict: Dictionary ) -> bool

Helper to check if logging should happen only once

func _get_context_from_stack( ) -> String

Helper to get context string from stack

func _is_likely_test_environment( ) -> bool

Helper to detect if we’re likely in a test environment

func log_at( level: LogLevel, p_message ) -> void

Central dispatcher that accepts a debug level and p_message which may be a String or a Callable provider.

func get_runtime_issues( ) -> Array[String]

Validates that debug settings have been injected. Returns list of validation issues (empty if valid).

func resolve_gb_dependencies( p_config: GBCompositionContainer ) -> bool

Receives injected dependencies from the composition container. Assigns debug settings if available.

func _init( p_debug_settings: GBDebugSettings ) -> void
func is_level_enabled( level: LogLevel ) -> bool

Returns true if the given debug level is enabled.

func is_debug_enabled( ) -> bool

Returns true if verbose/debug logging is currently enabled.

func is_verbose_enabled( ) -> bool

Returns true if verbose logging is currently enabled.

func is_trace_enabled( ) -> bool

Returns true if trace logging is currently enabled (the most detailed level).

func _materialize_message( p_provider ) -> String

Internal helper to materialize a message that may be a String or a Callable.

func log( level: LogLevel, p_message ) -> void

Alias log to the central dispatcher for convenience

func log_debug_lazy( p_provider: Callable ) -> void
func _emit_log( level: int, context: String, message: String ) -> void

Emits the log message to the appropriate output (console or custom sink).

func log_warning( p_issue: String ) -> void
func log_info( p_message: String ) -> void

Logs an informational message (between WARNING and DEBUG levels) Only prints when debug level >= INFO

func log_error( p_issue: String ) -> void

Logs an error message for the specified sender object.

p_issue: String - Error message to log

func log_warnings( p_issues: Array[String] ) -> void

Logs multiple warning messages for the specified sender object.

p_issues: Array[String] - Array of warning messages to log

func log_issues( p_issues: Array[String] ) -> void

Logs multiple issues as warnings (alias for log_warnings).

p_issues: Array[String] - Array of issue messages to log as warnings

func log_verbose( p_message: String ) -> void

Logs a verbose message for debugging purposes.

p_message: String - Verbose message to log

func log_trace( p_message: String ) -> void

Trace-level log for extremely detailed diagnostics (above VERBOSE)

func log_debug( p_message: String ) -> void

Debug-level log helper (alias of verbose at VERBOSE level)

func log_verbose_throttled( p_object: Object, p_message: String ) -> void

Throttled verbose logging: prints at most every N ms per object instance.

func log_debug_throttled( p_object: Object, p_message: String ) -> void

Throttled debug helper (alias of verbose throttled)

func log_trace_throttled( p_object: Object, p_message: String ) -> void

Throttled trace helper

func log_verbose_once( p_object: Object, p_message: String ) -> void

Logs a verbose message only once per object instance.

func log_debug_once( p_object: Object, p_message: String ) -> void

Log a debug message only once per object instance.

func log_trace_once( p_object: Object, p_message: String ) -> void

Log a trace message only once per object instance.

func log_warning_once( p_object: Object, p_message: String ) -> void

Log a warning message only once per object instance.

func log_error_once( p_object: Object, p_message: String ) -> void

Logs an error message, but only once per object instance.

func log_info_once( p_object: Object, p_message: String ) -> void

Logs an info message, but only once per object instance.

func get_debug_settings( ) -> GBDebugSettings

Returns the GBDebugSettings that the GBLogger is currently using

func set_log_level( p_level: LogLevel ) -> void

Change the level of the GBDebugSettings to change how much information is logged

addons/grid_building/logging/gb_logger.gd


This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.