Module: ExceptionGateway

Defined in:
lib/exception_gateway.rb,
lib/exception_gateway/version.rb,
lib/exception_gateway/vendors/bugsnag.rb

Defined Under Namespace

Modules: Vendors Classes: Config, Gateway

Constant Summary collapse

VERSION =
"0.2.6"

Class Method Summary collapse

Class Method Details

.alert(msg, options = {}) ⇒ Object



25
26
27
28
# File 'lib/exception_gateway.rb', line 25

def self.alert(msg, options={})
  method = "#{@@config.backend}_alert".to_s
  @@gateway.send method, msg, options
end

.configObject



21
22
23
# File 'lib/exception_gateway.rb', line 21

def self.config
  @@config
end

.configure {|c| ... } ⇒ Object

Yields:

  • (c)


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

def self.configure
  c = Config.new
  yield c
  @@config = c
  @@gateway = Gateway.new
end

.time(msg) ⇒ Object



35
36
37
38
39
40
# File 'lib/exception_gateway.rb', line 35

def self.time(msg)
  start_time = Time.now
  yield_value = yield
  end_time = Time.now
  self.alert(msg, :time => "#{(end_time - start_time) * 1000} ms")
end

.transmit(exception) ⇒ Object



30
31
32
33
# File 'lib/exception_gateway.rb', line 30

def self.transmit(exception)
  method = "#{@@config.backend}_transmit".to_s
  @@gateway.send method, exception
end