Class: LogStasher::ActiveSupport::LogSubscriber

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

Instance Method Summary collapse

Instance Method Details

#loggerObject



26
27
28
# File 'lib/logstasher/active_support/log_subscriber.rb', line 26

def logger
  LogStasher.logger
end

#process_action(event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/logstasher/active_support/log_subscriber.rb', line 7

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! 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



22
23
24
# File 'lib/logstasher/active_support/log_subscriber.rb', line 22

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