Class: LogstashRails::TransportBase

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash_rails/transport_base.rb

Overview

base class for transports

Instance Method Summary collapse

Constructor Details

#initialize(formatter, options) ⇒ TransportBase

Returns a new instance of TransportBase.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/logstash_rails/transport_base.rb', line 7

def initialize(formatter, options)
  @events = options[:events] || [/.*/]
  @error_logger = options[:logger]
  @raise_errors = options[:raise_errors] || false
  @formatter = formatter

  if defined?(Rails)
    @error_logger ||= Rails.logger
  end

  subscribe
end

Instance Method Details

#destroyObject

destroy

unsubscribe from ActiveSupport::Notifications



24
25
26
27
28
29
30
# File 'lib/logstash_rails/transport_base.rb', line 24

def destroy
  return unless @subscriptions

  @subscriptions.each do |subscription|
    ActiveSupport::Notifications.unsubscribe(subscription)
  end
end