Class: RequestTrail::Configuration
- Inherits:
-
Object
- Object
- RequestTrail::Configuration
- Defined in:
- lib/request_trail/configuration.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
- #formatter ⇒ Object
-
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
- #logger ⇒ Object
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#threshold_ms ⇒ Object
Returns the value of attribute threshold_ms.
Instance Method Summary collapse
- #ignored_path?(path) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #sampled? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 |
# File 'lib/request_trail/configuration.rb', line 10 def initialize @enabled = true @log_level = :info @threshold_ms = 0 @ignore_paths = [] @sample_rate = 1.0 end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
8 9 10 |
# File 'lib/request_trail/configuration.rb', line 8 def enabled @enabled end |
#formatter ⇒ Object
30 31 32 |
# File 'lib/request_trail/configuration.rb', line 30 def formatter @formatter ||= RequestTrail::Formatter.new end |
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
8 9 10 |
# File 'lib/request_trail/configuration.rb', line 8 def ignore_paths @ignore_paths end |
#log_level ⇒ Object
Returns the value of attribute log_level.
8 9 10 |
# File 'lib/request_trail/configuration.rb', line 8 def log_level @log_level end |
#logger ⇒ Object
26 27 28 |
# File 'lib/request_trail/configuration.rb', line 26 def logger @logger ||= rails_logger || Logger.new($stdout) end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
8 9 10 |
# File 'lib/request_trail/configuration.rb', line 8 def sample_rate @sample_rate end |
#threshold_ms ⇒ Object
Returns the value of attribute threshold_ms.
8 9 10 |
# File 'lib/request_trail/configuration.rb', line 8 def threshold_ms @threshold_ms end |
Instance Method Details
#ignored_path?(path) ⇒ Boolean
22 23 24 |
# File 'lib/request_trail/configuration.rb', line 22 def ignored_path?(path) ignore_paths.any? { |pattern| path_matches?(pattern, path) } end |
#sampled? ⇒ Boolean
18 19 20 |
# File 'lib/request_trail/configuration.rb', line 18 def sampled? rand < sample_rate end |