Class: Refile::CustomLogger Private

Inherits:
Object
  • Object
show all
Defined in:
lib/refile/custom_logger.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

LOG_FORMAT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

LOG_FORMAT = %(%s: [%s] %s “%s%s” %d %0.1fmsn)

%({"invoker": "%s", "time": "%s", "method": "%s", "path": "%s", "params": "%s", "status": %d, "duration": %0.1f})

Instance Method Summary collapse

Constructor Details

#initialize(app, prefix, logger_proc) ⇒ CustomLogger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CustomLogger.



9
10
11
12
13
# File 'lib/refile/custom_logger.rb', line 9

def initialize(app, prefix, logger_proc)
  @app = app
  @prefix = prefix
  @logger_proc = logger_proc
end

Instance Method Details

#call(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
# File 'lib/refile/custom_logger.rb', line 15

def call(env)
  began_at = Time.now
  status, header, body = @app.call(env)
  body = Rack::BodyProxy.new(body) { log(env, status, began_at) }
  [status, header, body]
end