Module: Raygun

Extended by:
DemoException
Defined in:
lib/raygun/sidekiq.rb,
lib/raygun.rb,
lib/raygun/error.rb,
lib/raygun/client.rb,
lib/raygun/version.rb,
lib/raygun/breadcrumbs.rb,
lib/raygun/affected_user.rb,
lib/raygun/configuration.rb,
lib/raygun/demo_exception.rb,
lib/raygun/breadcrumbs/store.rb,
lib/raygun/javascript_tracker.rb,
lib/raygun/breadcrumbs/breadcrumb.rb,
lib/generators/raygun/install_generator.rb,
lib/raygun/middleware/rack_exception_interceptor.rb,
lib/raygun/middleware/rails_insert_affected_user.rb,
lib/raygun/middleware/breadcrumbs_store_initializer.rb,
lib/raygun/services/apply_whitelist_filter_to_payload.rb

Overview

Client for injecting JavaScript code for tracking front end exceptions raygun.com/docs/languages/javascript

Defined Under Namespace

Modules: Breadcrumbs, DemoException, Middleware, Services Classes: AffectedUser, Client, Configuration, Error, ErrorSubscriber, InstallGenerator, ItWorksException, JavaScriptTracker, Railtie, SidekiqReporter

Constant Summary collapse

CLIENT_URL =

used to identify ourselves to Raygun

"https://github.com/MindscapeHQ/raygun4ruby"
CLIENT_NAME =
"Raygun4Ruby Gem"
VERSION =
"4.0.2"
@@active_futures =

List of futures that are currently running

[]

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from DemoException

track_test_exception

Class Attribute Details

.configurationObject



47
48
49
# File 'lib/raygun.rb', line 47

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configured?Boolean

Returns:

  • (Boolean)


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

def configured?
  !!configuration.api_key
end

.default_configurationObject



51
52
53
# File 'lib/raygun.rb', line 51

def default_configuration
  configuration.defaults
end

.deprecation_warning(message) ⇒ Object



117
118
119
120
121
122
123
# File 'lib/raygun.rb', line 117

def deprecation_warning(message)
  if defined?(ActiveSupport::Deprecation)
    ActiveSupport::Deprecation.warn(message)
  else
    puts message
  end
end

.failsafe_log(message) ⇒ Object



113
114
115
# File 'lib/raygun.rb', line 113

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

.log(message) ⇒ Object



107
108
109
110
111
# File 'lib/raygun.rb', line 107

def log(message)
  return unless configuration.debug

  configuration.logger.info("[Raygun] #{message}") if configuration.logger
end

.record_breadcrumb(message: nil, category: '', level: :info, timestamp: Time.now.utc, metadata: {}, class_name: nil, method_name: nil, line_number: nil) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/raygun.rb', line 83

def record_breadcrumb(
    message: nil,
    category: '',
    level: :info,
    timestamp: Time.now.utc,
    metadata: {},
    class_name: nil,
    method_name: nil,
    line_number: nil
)
  log('recording breadcrumb')

  Raygun::Breadcrumbs::Store.record(
    message: message,
    category: category,
    level: level,
    timestamp: timestamp,
    metadata: ,
    class_name: class_name,
    method_name: method_name,
    line_number: line_number,
  )
end

.reset_configurationObject



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

def reset_configuration
  @configuration = Configuration.new
end

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

Yields:



41
42
43
44
45
# File 'lib/raygun.rb', line 41

def setup
  yield(configuration)

  log("configuration settings: #{configuration.inspect}")
end

.track_exception(exception_instance, env = {}, user = nil, retries_remaining = configuration.error_report_max_attempts - 1) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/raygun.rb', line 63

def track_exception(exception_instance, env = {}, user = nil, retries_remaining = configuration.error_report_max_attempts - 1)
  log('tracking exception')
  
  exception_instance.set_backtrace(caller) if exception_instance.is_a?(Exception) && exception_instance.backtrace.nil?

  result = if configuration.send_in_background
    track_exception_async(exception_instance, env, user, retries_remaining)
  else
    track_exception_sync(exception_instance, env, user, retries_remaining)
  end

  result
end

.track_exceptionsObject



77
78
79
80
81
# File 'lib/raygun.rb', line 77

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

.wait_for_futuresObject



125
126
127
# File 'lib/raygun.rb', line 125

def wait_for_futures
  @@active_futures.each(&:value)
end