Sha256: 8710c432191567ad1c3ea74d313ba18dffa3f17e5d65002f5522c29db1c7f949

Contents?: true

Size: 1.15 KB

Versions: 34

Compression:

Stored size: 1.15 KB

Contents

module Timber
  # An integration represent an integration for an entire library. For example, `Rack`.
  # While the Timber `Rack` integration is comprised of multiple middlewares, the
  # `Timber::Integrations::Rack` module is an entire integration that extends this module.
  module Integration
    # Easily sisable entire library integrations. This is like removing the code from
    # Timber. It will not touch this library and the library will function as it would
    # without Timber.
    #
    # @example
    #   Timber::Integrations::ActiveRecord.enabled = false
    def enabled=(value)
      @enabled = value
    end

    # Accessor method for {#enabled=}
    def enabled?
      @enabled != false
    end

    # Silences a library's logs. This ensures that logs are not generated at all
    # from this library.
    #
    # @example
    #   Timber::Integrations::ActiveRecord.silence = true
    def silence=(value)
      @silence = value
    end

    # Accessor method for {#silence=}
    def silence?
      @silence == true
    end

    # Abstract method that each integration must implement.
    def integrate!
      raise NotImplementedError.new
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
timber-2.6.2 lib/timber/integration.rb
timber-2.6.1 lib/timber/integration.rb
timber-2.6.0 lib/timber/integration.rb
timber-2.6.0.pre.beta2 lib/timber/integration.rb
timber-2.6.0.pre.beta1 lib/timber/integration.rb
timber-2.5.1 lib/timber/integration.rb
timber-2.5.0 lib/timber/integration.rb
timber-2.4.0 lib/timber/integration.rb
timber-2.3.4 lib/timber/integration.rb
timber-2.3.3 lib/timber/integration.rb
timber-2.3.2 lib/timber/integration.rb
timber-2.3.1 lib/timber/integration.rb
timber-2.3.0 lib/timber/integration.rb
timber-2.2.3 lib/timber/integration.rb
timber-2.2.2 lib/timber/integration.rb
timber-2.2.1 lib/timber/integration.rb
timber-2.2.0 lib/timber/integration.rb
timber-2.1.10 lib/timber/integration.rb
timber-2.1.9 lib/timber/integration.rb
timber-2.1.8 lib/timber/integration.rb