Module: Smplkit::Debug

Defined in:
lib/smplkit/debug.rb

Overview

Internal debug logging for the smplkit SDK.

Controlled by the SMPLKIT_DEBUG environment variable. When enabled (+SMPLKIT_DEBUG=1+, true, or yes, case-insensitive), the SDK emits timestamped diagnostic lines to stderr covering every meaningful internal operation.

Debug output goes directly to $stderr.write — never through Ruby’s Logger — to avoid interfering with the managed logging framework the SDK controls.

Constant Summary collapse

TRUTHY =
%w[1 true yes].freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enabledObject

Returns the value of attribute enabled.



22
23
24
# File 'lib/smplkit/debug.rb', line 22

def enabled
  @enabled
end

Class Method Details

.emit(subsystem, message) ⇒ Object



32
33
34
35
36
37
# File 'lib/smplkit/debug.rb', line 32

def emit(subsystem, message)
  return unless @enabled

  ts = Time.now.utc.iso8601(6)
  $stderr.write("[smplkit:#{subsystem}] #{ts} #{message}\n")
end

.enable!Object



24
25
26
# File 'lib/smplkit/debug.rb', line 24

def enable!
  @enabled = true
end

.enabled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/smplkit/debug.rb', line 28

def enabled?
  @enabled
end