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.

%(%s: [%s] %s "%s%s" %d %0.1fms\n)

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.



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

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.



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

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