Module: ThreeScale::Backend::Logging::Middleware::Writer

Included in:
JsonWriter, TextWriter
Defined in:
lib/3scale/backend/logging/middleware/writer.rb

Instance Method Summary collapse

Instance Method Details

#initialize(logger = STDOUT) ⇒ Object



43
44
45
# File 'lib/3scale/backend/logging/middleware/writer.rb', line 43

def initialize(logger=STDOUT)
  @logger = logger
end

#log(env, status, header, began_at) ⇒ Object



47
48
49
50
51
# File 'lib/3scale/backend/logging/middleware/writer.rb', line 47

def log(env, status, header, began_at)
  data = log_data(env, status, header, began_at)
  log = formatted_log(data)
  logger(env).write(log)
end

#log_error(env, status, error, began_at) ⇒ Object



53
54
55
56
57
# File 'lib/3scale/backend/logging/middleware/writer.rb', line 53

def log_error(env, status, error, began_at)
  data = log_error_data(env, status, error, began_at)
  error = formatted_error(data)
  logger(env).write(error)
end