Class: Bugsnag::Configuration
- Inherits:
-
Object
- Object
- Bugsnag::Configuration
- Defined in:
- lib/bugsnag/configuration.rb
Constant Summary collapse
- THREAD_LOCAL_NAME =
"bugsnag_req_data"
- DEFAULT_ENDPOINT =
"notify.bugsnag.com"
- DEFAULT_PARAMS_FILTERS =
["password"].freeze
- DEFAULT_IGNORE_CLASSES =
[ "ActiveRecord::RecordNotFound", "ActionController::RoutingError", "ActionController::InvalidAuthenticityToken", "CGI::Session::CookieStore::TamperedWithCookie", "ActionController::UnknownAction", "AbstractController::ActionNotFound", "Mongoid::Errors::DocumentNotFound" ].freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#app_version ⇒ Object
Returns the value of attribute app_version.
-
#auto_notify ⇒ Object
Returns the value of attribute auto_notify.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#delay_with_resque ⇒ Object
Returns the value of attribute delay_with_resque.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#ignore_classes ⇒ Object
Returns the value of attribute ignore_classes.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#notify_release_stages ⇒ Object
Returns the value of attribute notify_release_stages.
-
#params_filters ⇒ Object
Returns the value of attribute params_filters.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#release_stage ⇒ Object
Returns the value of attribute release_stage.
-
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
Instance Method Summary collapse
- #clear_request_data ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #request_data ⇒ Object
- #set_request_data(key, value) ⇒ Object
- #should_notify? ⇒ Boolean
- #unset_request_data(key, value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bugsnag/configuration.rb', line 38 def initialize # Set up the defaults self.release_stage = nil self.notify_release_stages = ["production"] self.auto_notify = true self.use_ssl = false self.params_filters = Set.new(DEFAULT_PARAMS_FILTERS) self.ignore_classes = Set.new(DEFAULT_IGNORE_CLASSES) self.endpoint = DEFAULT_ENDPOINT # Set up logging self.logger = Logger.new(STDOUT) self.logger.level = Logger::WARN # Configure the bugsnag middleware stack self.middleware = Bugsnag::MiddlewareStack.new self.middleware.use Bugsnag::Middleware::Callbacks end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/bugsnag/configuration.rb', line 7 def api_key @api_key end |
#app_version ⇒ Object
Returns the value of attribute app_version.
13 14 15 |
# File 'lib/bugsnag/configuration.rb', line 13 def app_version @app_version end |
#auto_notify ⇒ Object
Returns the value of attribute auto_notify.
10 11 12 |
# File 'lib/bugsnag/configuration.rb', line 10 def auto_notify @auto_notify end |
#debug ⇒ Object
Returns the value of attribute debug.
20 21 22 |
# File 'lib/bugsnag/configuration.rb', line 20 def debug @debug end |
#delay_with_resque ⇒ Object
Returns the value of attribute delay_with_resque.
19 20 21 |
# File 'lib/bugsnag/configuration.rb', line 19 def delay_with_resque @delay_with_resque end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
16 17 18 |
# File 'lib/bugsnag/configuration.rb', line 16 def endpoint @endpoint end |
#ignore_classes ⇒ Object
Returns the value of attribute ignore_classes.
15 16 17 |
# File 'lib/bugsnag/configuration.rb', line 15 def ignore_classes @ignore_classes end |
#logger ⇒ Object
Returns the value of attribute logger.
17 18 19 |
# File 'lib/bugsnag/configuration.rb', line 17 def logger @logger end |
#middleware ⇒ Object
Returns the value of attribute middleware.
18 19 20 |
# File 'lib/bugsnag/configuration.rb', line 18 def middleware @middleware end |
#notify_release_stages ⇒ Object
Returns the value of attribute notify_release_stages.
9 10 11 |
# File 'lib/bugsnag/configuration.rb', line 9 def notify_release_stages @notify_release_stages end |
#params_filters ⇒ Object
Returns the value of attribute params_filters.
14 15 16 |
# File 'lib/bugsnag/configuration.rb', line 14 def params_filters @params_filters end |
#project_root ⇒ Object
Returns the value of attribute project_root.
12 13 14 |
# File 'lib/bugsnag/configuration.rb', line 12 def project_root @project_root end |
#release_stage ⇒ Object
Returns the value of attribute release_stage.
8 9 10 |
# File 'lib/bugsnag/configuration.rb', line 8 def release_stage @release_stage end |
#use_ssl ⇒ Object
Returns the value of attribute use_ssl.
11 12 13 |
# File 'lib/bugsnag/configuration.rb', line 11 def use_ssl @use_ssl end |
Instance Method Details
#clear_request_data ⇒ Object
73 74 75 |
# File 'lib/bugsnag/configuration.rb', line 73 def clear_request_data Thread.current[THREAD_LOCAL_NAME] = nil end |
#request_data ⇒ Object
61 62 63 |
# File 'lib/bugsnag/configuration.rb', line 61 def request_data Thread.current[THREAD_LOCAL_NAME] ||= {} end |
#set_request_data(key, value) ⇒ Object
65 66 67 |
# File 'lib/bugsnag/configuration.rb', line 65 def set_request_data(key, value) self.request_data[key] = value end |
#should_notify? ⇒ Boolean
57 58 59 |
# File 'lib/bugsnag/configuration.rb', line 57 def should_notify? @release_stage.nil? || @notify_release_stages.include?(@release_stage) end |
#unset_request_data(key, value) ⇒ Object
69 70 71 |
# File 'lib/bugsnag/configuration.rb', line 69 def unset_request_data(key, value) self.request_data.delete(key) end |