Class: Logx::Canonical

Inherits:
Object
  • Object
show all
Defined in:
lib/logx/canonical.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log) ⇒ Canonical

Returns a new instance of Canonical.



8
9
10
# File 'lib/logx/canonical.rb', line 8

def initialize(log)
  @log = log
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



6
7
8
# File 'lib/logx/canonical.rb', line 6

def log
  @log
end

Instance Method Details

#append(**kwargs) ⇒ Object



17
18
19
# File 'lib/logx/canonical.rb', line 17

def append(**kwargs)
  CurrentBuffer.append(**kwargs)
end

#flushObject



12
13
14
15
# File 'lib/logx/canonical.rb', line 12

def flush
  log.info CurrentBuffer.contents.to_json
  CurrentBuffer.reset
end