Module: Raygun

Extended by:
Testable
Defined in:
lib/raygun.rb,
lib/raygun/client.rb,
lib/raygun/version.rb,
lib/raygun/testable.rb,
lib/raygun/configuration.rb,
lib/generators/raygun/install_generator.rb,
lib/raygun/middleware/rack_exception_interceptor.rb,
lib/raygun/middleware/rails_insert_affected_user.rb

Defined Under Namespace

Modules: Middleware, Testable Classes: ApiKeyRequired, Client, Configuration, InstallGenerator, ItWorksException, Railtie

Constant Summary collapse

CLIENT_URL =

used to identify ourselves to Raygun

"https://github.com/MindscapeHQ/raygun4ruby"
CLIENT_NAME =
"Raygun4Ruby Gem"
VERSION =
"1.0.0"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Testable

track_test_exception

Class Attribute Details

.configurationObject



37
38
39
# File 'lib/raygun.rb', line 37

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.failsafe_log(message) ⇒ Object



64
65
66
# File 'lib/raygun.rb', line 64

def failsafe_log(message)
  configuration.failsafe_logger.info(message)
end

.log(message) ⇒ Object



60
61
62
# File 'lib/raygun.rb', line 60

def log(message)
  configuration.logger.info(message) if configuration.logger
end

.setup {|configuration| ... } ⇒ Object

Yields:



33
34
35
# File 'lib/raygun.rb', line 33

def setup
  yield(configuration)
end

.track_exception(exception_instance, env = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/raygun.rb', line 41

def track_exception(exception_instance, env = {})
  if should_report?(exception_instance)
    log("[Raygun] Tracking Exception...")
    Client.new.track_exception(exception_instance, env)
  end
rescue Exception => e
  if configuration.failsafe_logger
    failsafe_log("Problem reporting exception to Raygun: #{e.class}: #{e.message}\n\n#{e.backrace.join("\n")}")
  else
    raise e
  end
end

.track_exceptionsObject



54
55
56
57
58
# File 'lib/raygun.rb', line 54

def track_exceptions
  yield
rescue => e
  track_exception(e)
end