Module: Logtail::Integration

Defined in:
lib/logtail/integration.rb

Overview

An integration represent an integration for an entire library. For example, ‘Rack`. While the Logtail `Rack` integration is comprised of multiple middlewares, the `Logtail::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 Logtail. It will not touch this library and the library will function as it would without Logtail.

Examples:

Logtail::Integrations::ActiveRecord.enabled = false


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

def enabled=(value)
  @enabled = value
end

#enabled?Boolean

Accessor method for #enabled=

Returns:

  • (Boolean)


17
18
19
# File 'lib/logtail/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/logtail/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:

Logtail::Integrations::ActiveRecord.silence = true


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

def silence=(value)
  @silence = value
end

#silence?Boolean

Accessor method for #silence=

Returns:

  • (Boolean)


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

def silence?
  @silence == true
end