Class: Lograge::Formatters::Logstash
- Inherits:
-
Object
- Object
- Lograge::Formatters::Logstash
- Includes:
- Helpers::MethodAndPath
- Defined in:
- lib/lograge/formatters/logstash.rb
Instance Method Summary collapse
Methods included from Helpers::MethodAndPath
Instance Method Details
#call(data) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/lograge/formatters/logstash.rb', line 8 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 ⇒ Object
16 17 18 19 20 21 |
# File 'lib/lograge/formatters/logstash.rb', line 16 def load_dependencies require 'logstash-event' rescue LoadError puts 'You need to install the logstash-event gem to use the logstash output.' raise end |