class LittleGhost::Events::ConsoleListener
JSON-lines listener suitable for diagnostics and local development. Values pass through a Support::Redactor before being written.
Public Class Methods
# File lib/little_ghost/events.rb, line 41 def initialize(io: $stderr, redactor: Support::Redactor.new) @io = io @redactor = redactor @mutex = Mutex.new end
Writes redacted JSON lines to io.
Public Instance Methods
Source
# File lib/little_ghost/events.rb, line 48 def emit(event) @mutex.synchronize { @io.puts(JSON.generate(@redactor.call(event))) } end
Emits one complete JSON line atomically.