Class: LogStasher::ActiveSupport::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Includes:
CustomFields::LogSubscriber
Defined in:
lib/logstasher/active_support/log_subscriber.rb

Instance Method Summary collapse

Methods included from CustomFields::LogSubscriber

#extract_custom_fields

Instance Method Details

#loggerObject



32
33
34
# File 'lib/logstasher/active_support/log_subscriber.rb', line 32

def logger
  LogStasher.logger
end

#process_action(event) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/logstasher/active_support/log_subscriber.rb', line 12

def process_action(event)
  payload = event.payload

  data      = extract_request(payload)
  data.merge! extract_status(payload)
  data.merge! runtimes(event)
  data.merge! location(event)
  data.merge! extract_exception(payload)
  data.merge! LogStasher.store
  data.merge! extract_custom_fields(payload)

  tags = ['request']
  tags.push('exception') if payload[:exception]
  logger << "#{LogStasher.build_logstash_event(data, tags).to_json}\n"
end

#redirect_to(event) ⇒ Object



28
29
30
# File 'lib/logstasher/active_support/log_subscriber.rb', line 28

def redirect_to(event)
  Thread.current[:logstasher_location] = event.payload[:location]
end