GBLogger

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

sort Weight: 10

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

Version: v5.0.0

STABLE

Inherits: GBInjectable
Source: gb_logger.gd
Parsing: AST-based for maximum accuracy with symbol typing


Constants

VERBOSE_MIN_INTERVAL_MS

Internal default throttle interval for verbose logs (ms)


LogLevel

Shorthand alias for levels to reduce verbosity at callsites

Value: GBDebugSettings.LogLevel


Variables

_debug

Debug settings resource


_verbose_once:

Tracks messages printed once per (sender,key)


_debug_once:


_trace_once:


_warning_once:


_error_once:


_info_once:


_verbose_last_ts:

Tracks last-printed timestamp per (sender,key) for throttling


_log_sink:


Methods

create_with_injection

Signature: static create_with_injection(container: GBCompositionContainer) -> GBLogger

Creates a GBLogger with dependency injection from container.

Returns: GBLogger

Static: true

Parameters:

  • container: GBCompositionContainer

set_log_sink

Signature: set_log_sink(p_sink: Callable) -> void

Returns: void

Parameters:

  • p_sink: Callable

_get_caller_id

Signature: _get_caller_id() -> String

Helper to get caller identifier from stack

Returns: String


_is_throttled

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

Helper to check if logging should be throttled

Returns: bool

Parameters:

  • caller_id: String
  • key: String

_should_log_once

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

Helper to check if logging should happen only once

Returns: bool

Parameters:

  • caller_id: String
  • key: String
  • once_dict: Dictionary

_get_context_from_stack

Signature: _get_context_from_stack() -> String

Helper to get context string from stack

Returns: String


_is_likely_test_environment

Signature: _is_likely_test_environment() -> bool

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

Returns: bool


log_at

Signature: log_at(level: LogLevel, p_message: Variant) -> void

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

Returns: void

Parameters:

  • level: LogLevel
  • p_message: Variant

get_runtime_issues

Signature: get_runtime_issues() -> Array

Returns list of validation issues (empty if valid).

Returns: Array


resolve_gb_dependencies

Signature: resolve_gb_dependencies(p_config: GBCompositionContainer) -> bool

Assigns debug settings if available.

Returns: bool

Parameters:

  • p_config: GBCompositionContainer

_init

Signature: _init(p_debug_settings : GBDebugSettings: Variant) -> void

Returns: void

Parameters:

  • p_debug_settings : GBDebugSettings: Variant

is_level_enabled

Signature: is_level_enabled(level: LogLevel) -> bool

Returns true if the given debug level is enabled.

Returns: bool

Parameters:

  • level: LogLevel

is_debug_enabled

Signature: is_debug_enabled() -> bool

Returns true if verbose/debug logging is currently enabled.

Returns: bool


is_verbose_enabled

Signature: is_verbose_enabled() -> bool

Returns true if verbose logging is currently enabled.

Returns: bool


is_trace_enabled

Signature: is_trace_enabled() -> bool

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

Returns: bool


_materialize_message

Signature: _materialize_message(p_provider: Variant) -> String

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

Returns: String

Parameters:

  • p_provider: Variant

log

Signature: log(level: LogLevel, p_message: Variant) -> void

Alias log to the central dispatcher for convenience

Returns: void

Parameters:

  • level: LogLevel
  • p_message: Variant

log_debug_lazy

Signature: log_debug_lazy(p_provider: Callable) -> void

Returns: void

Parameters:

  • p_provider: Callable

_emit_log

Signature: _emit_log(level: int, context: String, message: String) -> void

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

Returns: void

Parameters:

  • level: int
  • context: String
  • message: String

log_warning

Signature: log_warning(p_issue: String) -> void

Returns: void

Parameters:

  • p_issue: String

log_info

Signature: log_info(p_message: String) -> void

Only prints when debug level >= INFO

Returns: void

Parameters:

  • p_message: String

log_error

Signature: log_error(p_issue: String) -> void

p_issue: String - Error message to log

Returns: void

Parameters:

  • p_issue: String

log_warnings

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

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

Returns: void

Parameters:

  • p_issues: Array[String]: Variant

log_issues

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

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

Returns: void

Parameters:

  • p_issues: Array[String]: Variant

log_verbose

Signature: log_verbose(p_message: String) -> void

p_message: String - Verbose message to log

Returns: void

Parameters:

  • p_message: String

log_trace

Signature: log_trace(p_message: String) -> void

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

Returns: void

Parameters:

  • p_message: String

log_debug

Signature: log_debug(p_message: String) -> void

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

Returns: void

Parameters:

  • p_message: String

log_verbose_throttled

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

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

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_debug_throttled

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

Throttled debug helper (alias of verbose throttled)

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_trace_throttled

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

Throttled trace helper

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_verbose_once

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

Logs a verbose message only once per object instance.

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_debug_once

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

Log a debug message only once per object instance.

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_trace_once

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

Log a trace message only once per object instance.

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_warning_once

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

Log a warning message only once per object instance.

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_error_once

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

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

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

log_info_once

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

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

Returns: void

Parameters:

  • p_object: Object
  • p_message: String

get_debug_settings

Signature: get_debug_settings() -> GBDebugSettings

Returns the GBDebugSettings that the GBLogger is currently using

Returns: GBDebugSettings


set_log_level

Signature: set_log_level(p_level: LogLevel) -> void

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

Returns: void

Parameters:

  • p_level: LogLevel