Module: LunaPark::Notifiers::TaggedLog::Formatter
- Defined in:
- lib/luna_park/notifiers/tagged_log.rb
Instance Method Summary collapse
- #call(severity, timestamp, progname, msg) ⇒ Object
- #clear_tags! ⇒ Object
- #current_tags ⇒ Object
- #pop_tags(size = 1) ⇒ Object
- #push_tags(*tags) ⇒ Object
- #tagged(*tags) ⇒ Object
- #tags_text ⇒ Object
Instance Method Details
#call(severity, timestamp, progname, msg) ⇒ Object
30 31 32 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 30 def call(severity, , progname, msg) super(severity, , progname, msg, ) end |
#clear_tags! ⇒ Object
52 53 54 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 52 def .clear end |
#current_tags ⇒ Object
56 57 58 59 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 56 def thread_key = @thread_key ||= "tagged_log_tag_store_tags:#{object_id}" Thread.current[thread_key] ||= [] end |
#pop_tags(size = 1) ⇒ Object
48 49 50 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 48 def (size = 1) .pop(size) end |
#push_tags(*tags) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 41 def (*) .flatten! .reject! { |tag| tag.respond_to?(:empty?) ? tag.empty? : !tag } .concat end |
#tagged(*tags) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 34 def tagged(*) = (*) yield self ensure (.size) end |
#tags_text ⇒ Object
61 62 63 |
# File 'lib/luna_park/notifiers/tagged_log.rb', line 61 def .join(' ').strip end |