GBLogger

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Centralized logging facility for the Grid Building plugin.

Source File: addons/grid_building/logging/gb_logger.gd

Extends: GBInjectable

Private Properties

  • Property: _debug := GBDebugSettings.new() (private)
  • Property: _verbose_once: Dictionary[String, bool] = {} (private)
  • Property: _debug_once: Dictionary[String, bool] = {} (private)
  • Property: _trace_once: Dictionary[String, bool] = {} (private)
  • Property: _warning_once: Dictionary[String, bool] = {} (private)
  • Property: _error_once: Dictionary[String, bool] = {} (private)
  • Property: _info_once: Dictionary[String, bool] = {} (private)
  • Property: _verbose_last_ts: Dictionary[String, int] = {} (private)
  • Property: _log_sink: Callable (private)

Constants

  • Constant: VERBOSE_MIN_INTERVAL_MS := 250
  • Constant: LogLevel = GBDebugSettings.LogLevel - Shorthand alias for levels to reduce verbosity at callsites

Public Methods

create_with_injection

1
create_with_injection(container: GBCompositionContainer) -> GBLogger

Flags: static

Creates a GBLogger with dependency injection from container.


set_log_sink

1
set_log_sink(p_sink: Callable) -> void

log_at

1
2
3
4
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.


get_runtime_issues

1
get_runtime_issues() -> Array[String]

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


resolve_gb_dependencies

1
resolve_gb_dependencies(p_config: GBCompositionContainer) -> bool

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


is_level_enabled

1
is_level_enabled(level: LogLevel) -> bool

Returns true if the given debug level is enabled.


is_debug_enabled

1
is_debug_enabled() -> bool

Returns true if verbose/debug logging is currently enabled.


is_verbose_enabled

1
is_verbose_enabled() -> bool

Returns true if verbose logging is currently enabled.


is_trace_enabled

1
is_trace_enabled() -> bool

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


log

1
2
3
4
log(
    level: LogLevel,
    p_message
) -> void

Alias log to the central dispatcher for convenience


log_debug_lazy

1
log_debug_lazy(p_provider: Callable) -> void

log_warning

1
log_warning(p_issue: String) -> void

log_info

1
log_info(p_message: String) -> void

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


log_error

1
log_error(p_issue: String) -> void

Logs an error message for the specified sender object.

p_issue: String - Error message to log


log_warnings

1
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


log_issues

1
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


log_verbose

1
log_verbose(p_message: String) -> void

Logs a verbose message for debugging purposes.

p_message: String - Verbose message to log


log_trace

1
log_trace(p_message: String) -> void

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


log_debug

1
log_debug(p_message: String) -> void

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


log_verbose_throttled

1
2
3
4
log_verbose_throttled(
    p_object: Object,
    p_message: String
) -> void

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


log_debug_throttled

1
2
3
4
log_debug_throttled(
    p_object: Object,
    p_message: String
) -> void

Throttled debug helper (alias of verbose throttled)


log_trace_throttled

1
2
3
4
log_trace_throttled(
    p_object: Object,
    p_message: String
) -> void

Throttled trace helper


log_verbose_once

1
2
3
4
log_verbose_once(
    p_object: Object,
    p_message: String
) -> void

Logs a verbose message only once per object instance.


log_debug_once

1
2
3
4
log_debug_once(
    p_object: Object,
    p_message: String
) -> void

Log a debug message only once per object instance.


log_trace_once

1
2
3
4
log_trace_once(
    p_object: Object,
    p_message: String
) -> void

Log a trace message only once per object instance.


log_warning_once

1
2
3
4
log_warning_once(
    p_object: Object,
    p_message: String
) -> void

Log a warning message only once per object instance.


log_error_once

1
2
3
4
log_error_once(
    p_object: Object,
    p_message: String
) -> void

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


log_info_once

1
2
3
4
log_info_once(
    p_object: Object,
    p_message: String
) -> void

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


get_debug_settings

1
get_debug_settings() -> GBDebugSettings

Returns the GBDebugSettings that the GBLogger is currently using


set_log_level

1
set_log_level(p_level: LogLevel) -> void

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


Private Methods

_get_caller_id

1
_get_caller_id() -> String

Flags: private

Helper to get caller identifier from stack


_is_throttled

1
2
3
4
_is_throttled(
    caller_id: String,
    key: String
) -> bool

Flags: private

Helper to check if logging should be throttled


_should_log_once

1
2
3
4
5
_should_log_once(
    caller_id: String,
    key: String,
    once_dict: Dictionary
) -> bool

Flags: private

Helper to check if logging should happen only once


_get_context_from_stack

1
_get_context_from_stack() -> String

Flags: private

Helper to get context string from stack


_is_likely_test_environment

1
_is_likely_test_environment() -> bool

Flags: private

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


_init

1
_init(p_debug_settings : GBDebugSettings) -> void

Flags: private


_materialize_message

1
_materialize_message(p_provider) -> String

Flags: private

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


_emit_log

1
2
3
4
5
_emit_log(
    level: int,
    context: String,
    message: String
) -> void

Flags: private

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