Class: DatawireQuarkCore::QuarkLayout
- Inherits:
-
Logging::Layout
- Object
- Logging::Layout
- DatawireQuarkCore::QuarkLayout
- Defined in:
- lib/datawire-quark-core.rb
Instance Method Summary collapse
- #format(event) ⇒ Object
-
#initialize ⇒ QuarkLayout
constructor
A new instance of QuarkLayout.
- #topic_of(event) ⇒ Object
Constructor Details
#initialize ⇒ QuarkLayout
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 |