Class: Logfoo::Rack::Log
- Inherits:
-
Object
- Object
- Logfoo::Rack::Log
- Defined in:
- lib/logfoo/integrations/rack/log.rb
Constant Summary collapse
- IGNORED =
%w{ /health /_ping }.freeze
- HTTP_X_FORWARDED_FOR =
'HTTP_X_FORWARDED_FOR'.freeze
- REMOTE_ADDR =
'REMOTE_ADDR'.freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, log = nil) ⇒ Log
constructor
A new instance of Log.
Constructor Details
#initialize(app, log = nil) ⇒ Log
Returns a new instance of Log.
7 8 9 10 |
# File 'lib/logfoo/integrations/rack/log.rb', line 7 def initialize(app, log = nil) @log = log || Logfoo.get_logger(LOGGER_NAME) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/logfoo/integrations/rack/log.rb', line 12 def call(env) began_at = Time.now status, header, body = @app.call(env) header = R::Utils::HeaderHash.new(header) body = R::BodyProxy.new(body) { log(env, status, header, began_at, body) } [status, header, body] end |