class InfinumGraylog::Notifier
Public Class Methods
new()
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 5 def initialize @notifier = GELF::Notifier.new(configuration.host, configuration.port, 'WAN', options) @notifier.collect_file_and_line = false end
notify(payload)
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 19 def self.notify(payload) return if payload.blank? instance.notify(payload) end
request_id=(request_id)
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 25 def self.request_id=(request_id) Thread.current[instance.thread_key] = request_id end
Public Instance Methods
notify(payload)
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 10 def notify(payload) payload = payload.merge(request_id: request_id) Thread.new { @notifier.notify!(payload) }.join end
thread_key()
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 15 def thread_key @thread_key ||= "infinum_graylog_notifier:#{object_id}" end
Private Instance Methods
configuration()
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 38 def configuration @configuration ||= InfinumGraylog.configuration end
options()
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 31 def options { protocol: configuration.protocol, level: configuration.level }.merge(configuration.options) end
request_id()
click to toggle source
# File lib/infinum_graylog/notifier.rb, line 42 def request_id Thread.current[thread_key] end