Class: ErrorTrack::Configuration
- Inherits:
-
Object
- Object
- ErrorTrack::Configuration
- Defined in:
- lib/error_track/configuration.rb
Instance Attribute Summary collapse
-
#current_user_resolver ⇒ Object
Proc called with (record) -> current user info hash, e.g.
-
#enabled ⇒ Object
Toggle capturing on/off (e.g. disable in test env).
-
#filtered_params ⇒ Object
Request param keys to scrub before storing (e.g. :password, :token).
-
#ignored_exceptions ⇒ Object
Exception classes that should never be recorded.
-
#retention_days ⇒ Object
How many days to keep resolved errors before they can be purged (purging itself is left to the host app via a rake task, this is just config).
Instance Method Summary collapse
- #ignored?(exception) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/error_track/configuration.rb', line 23 def initialize @enabled = true @ignored_exceptions = [ "ActionController::RoutingError", "ActiveRecord::RecordNotFound", "ActionController::InvalidAuthenticityToken" ] @filtered_params = %w[password password_confirmation token secret api_key] @current_user_resolver = nil @retention_days = 30 end |
Instance Attribute Details
#current_user_resolver ⇒ Object
Proc called with (record) -> current user info hash, e.g. config.current_user_resolver = ->(request) { user = request.env&.user { id: user&.id, email: user&.email } }
17 18 19 |
# File 'lib/error_track/configuration.rb', line 17 def current_user_resolver @current_user_resolver end |
#enabled ⇒ Object
Toggle capturing on/off (e.g. disable in test env)
4 5 6 |
# File 'lib/error_track/configuration.rb', line 4 def enabled @enabled end |
#filtered_params ⇒ Object
Request param keys to scrub before storing (e.g. :password, :token)
10 11 12 |
# File 'lib/error_track/configuration.rb', line 10 def filtered_params @filtered_params end |
#ignored_exceptions ⇒ Object
Exception classes that should never be recorded
7 8 9 |
# File 'lib/error_track/configuration.rb', line 7 def ignored_exceptions @ignored_exceptions end |
#retention_days ⇒ Object
How many days to keep resolved errors before they can be purged (purging itself is left to the host app via a rake task, this is just config)
21 22 23 |
# File 'lib/error_track/configuration.rb', line 21 def retention_days @retention_days end |
Instance Method Details
#ignored?(exception) ⇒ Boolean
35 36 37 |
# File 'lib/error_track/configuration.rb', line 35 def ignored?(exception) ignored_exceptions.include?(exception.class.name) end |