Class: EventSpider::Logger

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/logger.rb

Constant Summary collapse

REQUEST_FORMAT =
%{request: %s %s "%s" at %s from %s\nheaders: %s\n params: %s}
RESPONSE_FORMAT =
%{response: %s  used: %ss\nheaders: %s\nbody-length: %s body: %s}
ERROR_FORMAT =
%{  error: %s\n%s}
FILTER =
['password']

Instance Method Summary collapse

Constructor Details

#initialize(app, taggers = nil) ⇒ Logger

Returns a new instance of Logger.



15
16
17
18
# File 'lib/logger.rb', line 15

def initialize(app, taggers = nil)
  @app = app
  @taggers = taggers || []
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/logger.rb', line 20

def call(env)
  request = Rack::Request.new(env)

  if logger.respond_to?(:tagged)
    logger.tagged(compute_tags(request)) { call_app(request, env) }
  else
    call_app(request, env)
  end
end