class Lograge::Formatters::Logstash

Public Instance Methods

call(data) click to toggle source
# File lib/lograge/formatters/logstash.rb, line 6
def call(data)
  load_dependencies
  event = LogStash::Event.new(data)

  event['message'] = "[#{data[:status]}]#{method_and_path_string(data)}(#{data[:controller]}##{data[:action]})"
  event.to_json
end
load_dependencies() click to toggle source
# File lib/lograge/formatters/logstash.rb, line 14
def load_dependencies
  require 'logstash-event'
rescue LoadError
  puts 'You need to install the logstash-event gem to use the logstash output.'
  raise
end