Class: Tablexi::Logger

Inherits:
Object
  • Object
show all
Includes:
Severities
Defined in:
lib/tablexi/logger.rb,
lib/tablexi/logger/railtie.rb,
lib/tablexi/logger/rollbar.rb,
lib/tablexi/logger/version.rb,
lib/tablexi/logger/standard.rb,
lib/tablexi/logger/new_relic.rb,
lib/tablexi/logger/severities.rb,
lib/tablexi/logger/option_filter/humanize_request.rb

Defined Under Namespace

Modules: OptionFilter, Severities Classes: Railtie, Standard

Constant Summary collapse

Rollbar =
lambda do |error, options|
  ::Rollbar.error(error, options)
end
VERSION =
"1.2.0"
NewRelic =
lambda do |error, options|
  ::NewRelic::Agent.notice_error(error, options)
end

Constants included from Severities

Severities::SEVERITIES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



49
50
51
52
# File 'lib/tablexi/logger.rb', line 49

def initialize
  @option_filters = []
  @handlers = Hash.new { |h, k| h[k] = [] }
end

Instance Attribute Details

#handlersObject (readonly)

Returns the value of attribute handlers.



47
48
49
# File 'lib/tablexi/logger.rb', line 47

def handlers
  @handlers
end

#option_filtersObject (readonly)

Returns the value of attribute option_filters.



46
47
48
# File 'lib/tablexi/logger.rb', line 46

def option_filters
  @option_filters
end

Instance Method Details

#handle(severities, &block) ⇒ Object

Raises:

  • (ArgumentError)


54
55
56
57
58
# File 'lib/tablexi/logger.rb', line 54

def handle(severities, &block)
  raise ArgumentError, "Missing block argument" unless block_given?

  Array(severities).each { |severity| handlers[severity] << block }
end