Class: Exceptions::Backends::LogResult

Inherits:
Exceptions::Backend show all
Defined in:
lib/exceptions/backends/log_result.rb

Overview

Public: LogResult is an implementation of the Backend interface the wraps an existing backend and logs the result id and url.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend, logger = ::Logger.new(STDOUT)) ⇒ LogResult

Returns a new instance of LogResult.



10
11
12
13
# File 'lib/exceptions/backends/log_result.rb', line 10

def initialize(backend, logger = ::Logger.new(STDOUT))
  @backend = backend
  @logger  = logger
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



8
9
10
# File 'lib/exceptions/backends/log_result.rb', line 8

def backend
  @backend
end

#loggerObject (readonly)

Returns the value of attribute logger.



8
9
10
# File 'lib/exceptions/backends/log_result.rb', line 8

def logger
  @logger
end

Instance Method Details

#clear_context(*args) ⇒ Object



25
26
27
# File 'lib/exceptions/backends/log_result.rb', line 25

def clear_context(*args)
  backend.clear_context(*args)
end

#context(*args) ⇒ Object



21
22
23
# File 'lib/exceptions/backends/log_result.rb', line 21

def context(*args)
  backend.context(*args)
end

#notify(exception, options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/exceptions/backends/log_result.rb', line 15

def notify(exception, options = {})
  backend.notify(exception, options).tap do |result|
    log exception, result
  end
end