Module: Timber::Integration

Defined in:
lib/timber/integration.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#enabled=(value) ⇒ Object

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.

Examples:

Timber::Integrations::ActiveRecord.enabled = false


12
13
14
# File 'lib/timber/integration.rb', line 12

def enabled=(value)
  @enabled = value
end

#enabled?Boolean

Accessor method for #enabled=

Returns:

  • (Boolean)


17
18
19
# File 'lib/timber/integration.rb', line 17

def enabled?
  @enabled != false
end

#integrate!Object

Abstract method that each integration must implement.

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/timber/integration.rb', line 36

def integrate!
  raise NotImplementedError.new
end

#silence=(value) ⇒ Object

Silences a library’s logs. This ensures that logs are not generated at all from this library.

Examples:

Timber::Integrations::ActiveRecord.silence = true


26
27
28
# File 'lib/timber/integration.rb', line 26

def silence=(value)
  @silence = value
end

#silence?Boolean

Accessor method for #silence=

Returns:

  • (Boolean)


31
32
33
# File 'lib/timber/integration.rb', line 31

def silence?
  @silence == true
end