Class: DatawireQuarkCore::QuarkLayout

Inherits:
Logging::Layout
  • Object
show all
Defined in:
lib/datawire-quark-core.rb

Instance Method Summary collapse

Constructor Details

#initializeQuarkLayout

Returns a new instance of QuarkLayout.



442
443
444
# File 'lib/datawire-quark-core.rb', line 442

def initialize
  @namecache = {}
end

Instance Method Details

#format(event) ⇒ Object



445
446
447
448
449
450
# File 'lib/datawire-quark-core.rb', line 445

def format( event )
  level = ::Logging::LNAMES[event.level].upcase
  topic = topic_of(event)
  obj = format_obj(event.data)
  sprintf("%s %s %s\n", level, topic, obj)
end

#topic_of(event) ⇒ Object



451
452
453
454
455
456
457
458
# File 'lib/datawire-quark-core.rb', line 451

def topic_of(event)
  name = event.logger
  topic = @namecache[name]
  if topic.nil?
    @namecache[name] = topic = name.gsub("::",".")
  end
  topic
end