timber 2.6.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +8 -38
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +30 -284
  5. data/Rakefile +78 -0
  6. data/lib/timber.rb +6 -6
  7. data/lib/timber/config.rb +1 -83
  8. data/lib/timber/config/integrations.rb +1 -47
  9. data/lib/timber/context.rb +3 -24
  10. data/lib/timber/contexts.rb +2 -30
  11. data/lib/timber/contexts/http.rb +16 -36
  12. data/lib/timber/contexts/release.rb +12 -23
  13. data/lib/timber/contexts/runtime.rb +9 -36
  14. data/lib/timber/contexts/session.rb +8 -21
  15. data/lib/timber/contexts/system.rb +9 -16
  16. data/lib/timber/contexts/user.rb +13 -33
  17. data/lib/timber/current_context.rb +16 -78
  18. data/lib/timber/event.rb +12 -9
  19. data/lib/timber/events.rb +1 -33
  20. data/lib/timber/events/controller_call.rb +20 -31
  21. data/lib/timber/events/error.rb +18 -26
  22. data/lib/timber/events/exception.rb +1 -0
  23. data/lib/timber/events/sql_query.rb +14 -24
  24. data/lib/timber/events/template_render.rb +13 -24
  25. data/lib/timber/integration.rb +1 -1
  26. data/lib/timber/integrator.rb +1 -1
  27. data/lib/timber/log_devices/http.rb +98 -19
  28. data/lib/timber/log_entry.rb +6 -24
  29. data/lib/timber/logger.rb +5 -14
  30. data/lib/timber/util.rb +1 -6
  31. data/lib/timber/util/non_nil_hash_builder.rb +3 -1
  32. data/lib/timber/version.rb +1 -1
  33. data/spec/README.md +2 -8
  34. data/spec/spec_helper.rb +0 -7
  35. data/spec/support/timber.rb +1 -3
  36. data/spec/timber/current_context_spec.rb +12 -50
  37. data/spec/timber/events/controller_call_spec.rb +4 -4
  38. data/spec/timber/events/error_spec.rb +4 -9
  39. data/spec/timber/log_devices/http_spec.rb +26 -2
  40. data/spec/timber/log_entry_spec.rb +12 -6
  41. data/spec/timber/logger_spec.rb +27 -68
  42. data/timber.gemspec +1 -1
  43. metadata +5 -139
  44. data/gemfiles/rails-3.0.gemfile +0 -5
  45. data/gemfiles/rails-3.1.gemfile +0 -5
  46. data/gemfiles/rails-3.2.gemfile +0 -5
  47. data/gemfiles/rails-4.0.gemfile +0 -9
  48. data/gemfiles/rails-4.1.gemfile +0 -9
  49. data/gemfiles/rails-4.2.gemfile +0 -9
  50. data/gemfiles/rails-5.0.gemfile +0 -9
  51. data/gemfiles/rails-5.1.gemfile +0 -9
  52. data/gemfiles/rails-edge.gemfile +0 -7
  53. data/lib/timber/cli.rb +0 -60
  54. data/lib/timber/cli/api.rb +0 -183
  55. data/lib/timber/cli/api/application.rb +0 -34
  56. data/lib/timber/cli/config_file.rb +0 -71
  57. data/lib/timber/cli/file_helper.rb +0 -53
  58. data/lib/timber/cli/installer.rb +0 -70
  59. data/lib/timber/cli/installers.rb +0 -102
  60. data/lib/timber/cli/installers/config_file.rb +0 -51
  61. data/lib/timber/cli/installers/other.rb +0 -59
  62. data/lib/timber/cli/installers/rails.rb +0 -225
  63. data/lib/timber/cli/installers/root.rb +0 -116
  64. data/lib/timber/cli/io.rb +0 -100
  65. data/lib/timber/cli/io/ansi.rb +0 -22
  66. data/lib/timber/cli/io/messages.rb +0 -198
  67. data/lib/timber/cli/os_helper.rb +0 -74
  68. data/lib/timber/config/integrations/rack.rb +0 -74
  69. data/lib/timber/contexts/custom.rb +0 -44
  70. data/lib/timber/contexts/organization.rb +0 -48
  71. data/lib/timber/events/custom.rb +0 -53
  72. data/lib/timber/events/http_request.rb +0 -71
  73. data/lib/timber/events/http_response.rb +0 -81
  74. data/lib/timber/frameworks.rb +0 -19
  75. data/lib/timber/frameworks/rails.rb +0 -27
  76. data/lib/timber/integrations.rb +0 -29
  77. data/lib/timber/integrations/action_controller.rb +0 -18
  78. data/lib/timber/integrations/action_controller/log_subscriber.rb +0 -27
  79. data/lib/timber/integrations/action_controller/log_subscriber/timber_log_subscriber.rb +0 -46
  80. data/lib/timber/integrations/action_dispatch.rb +0 -23
  81. data/lib/timber/integrations/action_dispatch/debug_exceptions.rb +0 -53
  82. data/lib/timber/integrations/action_view.rb +0 -18
  83. data/lib/timber/integrations/action_view/log_subscriber.rb +0 -27
  84. data/lib/timber/integrations/action_view/log_subscriber/timber_log_subscriber.rb +0 -83
  85. data/lib/timber/integrations/active_record.rb +0 -18
  86. data/lib/timber/integrations/active_record/log_subscriber.rb +0 -26
  87. data/lib/timber/integrations/active_record/log_subscriber/timber_log_subscriber.rb +0 -53
  88. data/lib/timber/integrations/rack.rb +0 -27
  89. data/lib/timber/integrations/rack/error_event.rb +0 -64
  90. data/lib/timber/integrations/rack/http_context.rb +0 -27
  91. data/lib/timber/integrations/rack/http_events.rb +0 -210
  92. data/lib/timber/integrations/rack/middleware.rb +0 -28
  93. data/lib/timber/integrations/rack/session_context.rb +0 -65
  94. data/lib/timber/integrations/rack/user_context.rb +0 -135
  95. data/lib/timber/integrations/rails.rb +0 -22
  96. data/lib/timber/integrations/rails/rack_logger.rb +0 -60
  97. data/lib/timber/overrides.rb +0 -12
  98. data/lib/timber/overrides/active_support_3_tagged_logging.rb +0 -111
  99. data/lib/timber/overrides/active_support_buffered_logger.rb +0 -22
  100. data/lib/timber/overrides/active_support_tagged_logging.rb +0 -66
  101. data/lib/timber/overrides/lograge.rb +0 -18
  102. data/lib/timber/overrides/rails_stdout_logging.rb +0 -21
  103. data/lib/timber/util/active_support_log_subscriber.rb +0 -37
  104. data/lib/timber/util/attribute_normalizer.rb +0 -89
  105. data/lib/timber/util/hash.rb +0 -90
  106. data/lib/timber/util/request.rb +0 -72
  107. data/lib/timber/util/struct.rb +0 -16
  108. data/spec/rails/tagged_logging_spec.rb +0 -44
  109. data/spec/support/action_controller.rb +0 -8
  110. data/spec/support/active_record.rb +0 -32
  111. data/spec/support/rails.rb +0 -67
  112. data/spec/support/rails/templates/_partial.html +0 -1
  113. data/spec/support/rails/templates/template.html +0 -1
  114. data/spec/timber/cli/config_file_spec.rb +0 -26
  115. data/spec/timber/cli/installers/config_file_spec.rb +0 -36
  116. data/spec/timber/cli/installers/other_spec.rb +0 -49
  117. data/spec/timber/cli/installers/rails_spec.rb +0 -364
  118. data/spec/timber/cli/installers/root_spec.rb +0 -73
  119. data/spec/timber/config_spec.rb +0 -28
  120. data/spec/timber/contexts/custom_spec.rb +0 -11
  121. data/spec/timber/contexts/organization_spec.rb +0 -11
  122. data/spec/timber/contexts/runtime_spec.rb +0 -11
  123. data/spec/timber/contexts/system_spec.rb +0 -11
  124. data/spec/timber/contexts/user_spec.rb +0 -11
  125. data/spec/timber/contexts_spec.rb +0 -49
  126. data/spec/timber/event_spec.rb +0 -10
  127. data/spec/timber/events/custom_spec.rb +0 -36
  128. data/spec/timber/events/http_request_spec.rb +0 -32
  129. data/spec/timber/events/http_response_spec.rb +0 -12
  130. data/spec/timber/events_spec.rb +0 -55
  131. data/spec/timber/integrations/action_controller/log_subscriber_spec.rb +0 -55
  132. data/spec/timber/integrations/action_dispatch/debug_exceptions_spec.rb +0 -53
  133. data/spec/timber/integrations/action_view/log_subscriber_spec.rb +0 -115
  134. data/spec/timber/integrations/active_record/log_subscriber_spec.rb +0 -46
  135. data/spec/timber/integrations/rack/error_event_spec.rb +0 -63
  136. data/spec/timber/integrations/rack/http_context_spec.rb +0 -60
  137. data/spec/timber/integrations/rack/http_events_spec.rb +0 -101
  138. data/spec/timber/integrations/rack/session_context_spec.rb +0 -62
  139. data/spec/timber/integrations/rails/rack_logger_spec.rb +0 -58
  140. data/spec/timber/util/attribute_normalizer_spec.rb +0 -90
  141. data/spec/timber/util/hash_spec.rb +0 -30
  142. data/spec/timber/util/request_spec.rb +0 -10
@@ -1,71 +0,0 @@
1
- require "timber/event"
2
- require "timber/util"
3
-
4
- module Timber
5
- module Events
6
- # The HTTP server request event tracks incoming HTTP requests to your HTTP server.
7
- # Such as unicorn, webrick, puma, etc.
8
- #
9
- # @note This event should be installed automatically through integrations,
10
- # such as the {Integrations::ActionController::LogSubscriber} integration.
11
- class HTTPRequest < Timber::Event
12
- BODY_MAX_BYTES = 8192.freeze
13
- HEADERS_JSON_MAX_BYTES = 8192.freeze
14
- HEADERS_TO_SANITIZE = ['authorization', 'x-amz-security-token'].freeze
15
- HOST_MAX_BYTES = 256.freeze
16
- METHOD_MAX_BYTES = 20.freeze
17
- PATH_MAX_BYTES = 2048.freeze
18
- QUERY_STRING_MAX_BYTES = 2048.freeze
19
- REQUEST_ID_MAX_BYTES = 256.freeze
20
- SCHEME_MAX_BYTES = 20.freeze
21
- SERVICE_NAME_MAX_BYTES = 256.freeze
22
-
23
- attr_reader :body, :content_length, :headers, :host, :method, :path, :port, :query_string,
24
- :request_id, :scheme, :service_name
25
-
26
- def initialize(attributes)
27
- normalizer = Util::AttributeNormalizer.new(attributes)
28
- body_limit = Config.instance.http_body_limit || BODY_MAX_BYTES
29
- headers_to_sanitize = HEADERS_TO_SANITIZE + (Config.instance.http_header_filters || [])
30
-
31
- @body = normalizer.fetch(:body, :string, :limit => body_limit)
32
- @content_length = normalizer.fetch(:content_length, :integer)
33
- @headers = normalizer.fetch(:headers, :hash, :sanitize => headers_to_sanitize)
34
- @host = normalizer.fetch(:host, :string, :limit => HOST_MAX_BYTES)
35
- @method = normalizer.fetch!(:method, :string, :upcase => true, :limit => METHOD_MAX_BYTES)
36
- @path = normalizer.fetch(:path, :string, :limit => PATH_MAX_BYTES)
37
- @port = normalizer.fetch(:port, :integer)
38
- @query_string = normalizer.fetch(:query_string, :string, :limit => QUERY_STRING_MAX_BYTES)
39
- @scheme = normalizer.fetch(:scheme, :string, :limit => SCHEME_MAX_BYTES)
40
- @request_id = normalizer.fetch(:request_id, :string, :limit => REQUEST_ID_MAX_BYTES)
41
- @service_name = normalizer.fetch(:service_name, :string, :limit => SERVICE_NAME_MAX_BYTES)
42
- end
43
-
44
- def to_hash
45
- @to_hash ||= Util::NonNilHashBuilder.build do |h|
46
- h.add(:body, body)
47
- h.add(:content_length, content_length)
48
- h.add(:headers_json, headers, :json_encode => true, :limit => HEADERS_JSON_MAX_BYTES)
49
- h.add(:host, host)
50
- h.add(:method, method)
51
- h.add(:path, path)
52
- h.add(:port, port)
53
- h.add(:query_string, query_string)
54
- h.add(:request_id, request_id)
55
- h.add(:scheme, scheme)
56
- h.add(:service_name, service_name)
57
- end
58
- end
59
- alias to_h to_hash
60
-
61
- # Builds a hash representation containing simple objects, suitable for serialization (JSON).
62
- def as_json(_options = {})
63
- {:http_request => to_hash}
64
- end
65
-
66
- def message
67
- 'Started %s "%s"' % [method, path]
68
- end
69
- end
70
- end
71
- end
@@ -1,81 +0,0 @@
1
- require "timber/event"
2
- require "timber/util"
3
-
4
- module Timber
5
- module Events
6
- # The HTTP server response event tracks outgoing HTTP responses that you send
7
- # to clients.
8
- #
9
- # @note This event should be installed automatically through integrations,
10
- # such as the {Integrations::ActionController::LogSubscriber} integration.
11
- class HTTPResponse < Timber::Event
12
- BODY_MAX_BYTES = 8192.freeze
13
- HEADERS_JSON_MAX_BYTES = 256.freeze
14
- HEADERS_TO_SANITIZE = ['authorization', 'x-amz-security-token'].freeze
15
- REQUEST_ID_MAX_BYTES = 256.freeze
16
- SERVICE_NAME_MAX_BYTES = 256.freeze
17
-
18
- attr_reader :body, :content_length, :headers, :http_context, :request_id, :service_name,
19
- :status, :time_ms
20
-
21
- def initialize(attributes)
22
- normalizer = Util::AttributeNormalizer.new(attributes)
23
- body_limit = Config.instance.http_body_limit || BODY_MAX_BYTES
24
- headers_to_sanitize = HEADERS_TO_SANITIZE + (Config.instance.http_header_filters || [])
25
-
26
- @body = normalizer.fetch(:body, :string, :limit => body_limit)
27
- @content_length = normalizer.fetch(:content_length, :integer)
28
- @headers = normalizer.fetch(:headers, :hash, :sanitize => headers_to_sanitize)
29
- @http_context = attributes[:http_context]
30
- @request_id = normalizer.fetch(:request_id, :string, :limit => REQUEST_ID_MAX_BYTES)
31
- @service_name = normalizer.fetch(:service_name, :string, :limit => SERVICE_NAME_MAX_BYTES)
32
- @status = normalizer.fetch!(:status, :integer)
33
- @time_ms = normalizer.fetch!(:time_ms, :float, :precision => 6)
34
- end
35
-
36
- def to_hash
37
- @to_hash ||= Util::NonNilHashBuilder.build do |h|
38
- h.add(:body, body)
39
- h.add(:content_length, content_length)
40
- h.add(:headers_json, headers, :json_encode => true, :limit => HEADERS_JSON_MAX_BYTES)
41
- h.add(:request_id, request_id)
42
- h.add(:service_name, service_name)
43
- h.add(:status, status)
44
- h.add(:time_ms, time_ms)
45
- end
46
- end
47
- alias to_h to_hash
48
-
49
- # Builds a hash representation containing simple objects, suitable for serialization (JSON).
50
- def as_json(_options = {})
51
- {:http_response => to_hash}
52
- end
53
-
54
- # Returns the human readable log message for this event.
55
- def message
56
- if http_context
57
- message = "#{http_context[:method]} #{http_context[:path]} completed with " \
58
- "#{status} #{status_description} "
59
-
60
- if content_length
61
- message << ", #{content_length} bytes, "
62
- end
63
-
64
- message << "in #{time_ms}ms"
65
- else
66
- message = "Completed #{status} #{status_description} "
67
-
68
- if content_length
69
- message << ", #{content_length} bytes, "
70
- end
71
-
72
- message << "in #{time_ms}ms"
73
- end
74
- end
75
-
76
- def status_description
77
- Rack::Utils::HTTP_STATUS_CODES[status]
78
- end
79
- end
80
- end
81
- end
@@ -1,19 +0,0 @@
1
- require "logger"
2
-
3
- # Attempt to require Rails. We can not list it as a gem
4
- # dependency because we want to support multiple frameworks.
5
- begin
6
- require "rails"
7
- rescue LoadError
8
- end
9
-
10
- if defined?(::Rails) && defined?(::Rails::Railtie)
11
- require "timber/frameworks/rails"
12
- end
13
-
14
- module Timber
15
- # Namespace for installing Timber into frameworks
16
- # @private
17
- module Frameworks
18
- end
19
- end
@@ -1,27 +0,0 @@
1
- module Timber
2
- module Frameworks
3
- # Module for Rails specific code, such as the Railtie and any methods that assist
4
- # with Rails setup.
5
- module Rails
6
- # Installs Timber into your Rails app automatically.
7
- class Railtie < ::Rails::Railtie
8
- config.timber = Config.instance
9
-
10
- config.before_initialize do
11
- Timber::Config.instance.logger = Proc.new { ::Rails.logger }
12
- end
13
-
14
- # Must be loaded after initializers so that we respect any Timber configuration set
15
- initializer(:timber, before: :build_middleware_stack, after: :load_config_initializers) do
16
- Integrations.integrate!
17
-
18
- # Install the Rack middlewares so that we capture structured data instead of
19
- # raw text logs.
20
- Integrations::Rack.middlewares.collect do |middleware_class|
21
- config.app_middleware.use middleware_class
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,29 +0,0 @@
1
- require "timber/integrations/action_controller"
2
- require "timber/integrations/action_dispatch"
3
- require "timber/integrations/action_view"
4
- require "timber/integrations/active_record"
5
- require "timber/integrations/rack"
6
- require "timber/integrations/rails"
7
-
8
- module Timber
9
- # Namespace for all integrations. Each integration provides it's own settings.
10
- # And all integrations can be disabled with the {.enabled=} class method.
11
- module Integrations
12
- # Disable / enable _all_ integrations with one setting.
13
- def self.enabled=(value)
14
- ActionController.enabled = value
15
- ActionView.enabled = value
16
- ActiveRecord.enabled = value
17
- Rack.enabled = value
18
- end
19
-
20
- # Integrates all enabled integrations in one call.
21
- def self.integrate!
22
- ActionController.integrate!
23
- ActionDispatch.integrate!
24
- ActionView.integrate!
25
- ActiveRecord.integrate!
26
- Rails.integrate!
27
- end
28
- end
29
- end
@@ -1,18 +0,0 @@
1
- require "timber/integration"
2
- require "timber/integrations/action_controller/log_subscriber"
3
-
4
- module Timber
5
- module Integrations
6
- # Module for holding *all* ActionController integrations. See {Integration} for
7
- # configuration details for all integrations.
8
- module ActionController
9
- extend Integration
10
-
11
- def self.integrate!
12
- return false if !enabled?
13
-
14
- LogSubscriber.integrate!
15
- end
16
- end
17
- end
18
- end
@@ -1,27 +0,0 @@
1
- require "timber/integrator"
2
-
3
- module Timber
4
- module Integrations
5
- module ActionController
6
- # Responsible for removing the default ActionController::LogSubscriber and installing
7
- # the TimberLogSubscriber
8
- #
9
- # @private
10
- class LogSubscriber < Integrator
11
- def initialize
12
- require "action_controller/log_subscriber"
13
- require "timber/integrations/action_controller/log_subscriber/timber_log_subscriber"
14
- rescue LoadError => e
15
- raise RequirementNotMetError.new(e.message)
16
- end
17
-
18
- def integrate!
19
- return true if Util::ActiveSupportLogSubscriber.subscribed?(:action_controller, TimberLogSubscriber)
20
-
21
- Util::ActiveSupportLogSubscriber.unsubscribe!(:action_controller, ::ActionController::LogSubscriber)
22
- TimberLogSubscriber.attach_to(:action_controller)
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,46 +0,0 @@
1
- module Timber
2
- module Integrations
3
- module ActionController
4
- class LogSubscriber < Integrator
5
- # The log subscriber that replaces the default `ActionController::LogSubscriber`.
6
- # The intent of this subscriber is to, as transparently as possible, properly
7
- # track events that are being logged here. This LogSubscriber will never change
8
- # default behavior / log messages.
9
- #
10
- # @private
11
- class TimberLogSubscriber < ::ActionController::LogSubscriber
12
- def start_processing(event)
13
- return true if silence?
14
-
15
- info do
16
- payload = event.payload
17
- params = payload[:params].except(*INTERNAL_PARAMS)
18
- format = extract_format(payload)
19
- format = format.to_s.upcase if format.is_a?(Symbol)
20
-
21
- Events::ControllerCall.new(
22
- controller: payload[:controller],
23
- action: payload[:action],
24
- format: format,
25
- params: params
26
- )
27
- end
28
- end
29
-
30
- private
31
- def extract_format(payload)
32
- if payload.key?(:format)
33
- payload[:format] # rails > 4.X
34
- elsif payload.key?(:formats)
35
- payload[:formats].first # rails 3.X
36
- end
37
- end
38
-
39
- def silence?
40
- ActionController.silence?
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,23 +0,0 @@
1
- require "timber/integration"
2
- require "timber/integrations/rack/error_event"
3
- require "timber/integrations/action_dispatch/debug_exceptions"
4
-
5
- module Timber
6
- module Integrations
7
- # Module for holding *all* ActionDispatch integrations. This module does *not*
8
- # extend {Integration} because it's dependent on {Rack::ExceptionEvent}. This
9
- # module simply disables the exception tracking middleware so that our middleware
10
- # works as expected.
11
- module ActionDispatch
12
- def self.enabled?
13
- Rack::ErrorEvent.enabled?
14
- end
15
-
16
- def self.integrate!
17
- return false if !enabled?
18
-
19
- DebugExceptions.integrate!
20
- end
21
- end
22
- end
23
- end
@@ -1,53 +0,0 @@
1
- require "timber/integrator"
2
-
3
- module Timber
4
- module Integrations
5
- module ActionDispatch
6
- # Reponsible for disabled logging in the ActionDispatch::DebugExceptions
7
- # Rack middleware. We cannot simply remove the middleware because it is
8
- # coupled with displaying an exception debug screen if debug exceptions is enabled.
9
- #
10
- # @private
11
- class DebugExceptions < Integrator
12
-
13
- # Patch for disabling logging
14
- #
15
- # @private
16
- module InstanceMethods
17
- def self.included(klass)
18
- klass.class_eval do
19
- private
20
- def logger(*args)
21
- nil
22
- end
23
- end
24
- end
25
- end
26
-
27
- def initialize
28
- begin
29
- # Rails >= 3.1
30
- require "action_dispatch/middleware/debug_exceptions"
31
- rescue LoadError
32
- # Rails < 3.1
33
- require "action_dispatch/middleware/show_exceptions"
34
- end
35
- rescue LoadError => e
36
- raise RequirementNotMetError.new(e.message)
37
- end
38
-
39
- def integrate!
40
- if defined?(::ActionDispatch::DebugExceptions) && !::ActionDispatch::DebugExceptions.include?(InstanceMethods)
41
- ::ActionDispatch::DebugExceptions.send(:include, InstanceMethods)
42
- end
43
-
44
- if defined?(::ActionDispatch::ShowExceptions) && !::ActionDispatch::ShowExceptions.include?(InstanceMethods)
45
- ::ActionDispatch::ShowExceptions.send(:include, InstanceMethods)
46
- end
47
-
48
- true
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,18 +0,0 @@
1
- require "timber/integration"
2
- require "timber/integrations/action_view/log_subscriber"
3
-
4
- module Timber
5
- module Integrations
6
- # Module for holding *all* ActionView integrations. See {Integration} for
7
- # configuration details for all integrations.
8
- module ActionView
9
- extend Integration
10
-
11
- def self.integrate!
12
- return false if !enabled?
13
-
14
- LogSubscriber.integrate!
15
- end
16
- end
17
- end
18
- end
@@ -1,27 +0,0 @@
1
- require "timber/integrator"
2
-
3
- module Timber
4
- module Integrations
5
- module ActionView
6
- # Reponsible for uninstalling the default `ActionView::LogSubscriber` and installing
7
- # the TimberLogSubscriber.
8
- #
9
- # @private
10
- class LogSubscriber < Integrator
11
- def initialize
12
- require "action_view/log_subscriber"
13
- require "timber/integrations/action_view/log_subscriber/timber_log_subscriber"
14
- rescue LoadError => e
15
- raise RequirementNotMetError.new(e.message)
16
- end
17
-
18
- def integrate!
19
- return true if Util::ActiveSupportLogSubscriber.subscribed?(:action_view, TimberLogSubscriber)
20
-
21
- Util::ActiveSupportLogSubscriber.unsubscribe!(:action_view, ::ActionView::LogSubscriber)
22
- TimberLogSubscriber.attach_to(:action_view)
23
- end
24
- end
25
- end
26
- end
27
- end