Class: LoggerFacade::Plugins::Airbrake

Inherits:
Object
  • Object
show all
Defined in:
lib/logger_facade/plugins/airbrake.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment = nil) ⇒ Airbrake

Returns a new instance of Airbrake.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/logger_facade/plugins/airbrake.rb', line 9

def initialize(environment = nil)
  @name = "LoggerFacade::Plugins::Airbrake"
  @environment = environment.to_s

  ::Airbrake.configure do |config|
    config.host    = nil
    config.port    = 80
    config.secure  = config.port == 443
    config.async   = true
    config.development_environments = %w(development test)
  end
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment.



7
8
9
# File 'lib/logger_facade/plugins/airbrake.rb', line 7

def environment
  @environment
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/logger_facade/plugins/airbrake.rb', line 7

def name
  @name
end

Instance Method Details

#configure(&block) ⇒ Object



22
23
24
25
26
# File 'lib/logger_facade/plugins/airbrake.rb', line 22

def configure(&block)
  ::Airbrake.configure do |config|
    yield config
  end
end

#debug(logger, message) ⇒ Object



36
37
38
# File 'lib/logger_facade/plugins/airbrake.rb', line 36

def debug(logger, message)
  # do nothing
end

#error(logger, message) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/logger_facade/plugins/airbrake.rb', line 48

def error(logger, message)
  return unless valid_config

  if message.is_a? Exception
    notify_exception(message, logger)
  else
    notify_error_log(message, logger)
  end
end

#info(logger, message) ⇒ Object



40
41
42
# File 'lib/logger_facade/plugins/airbrake.rb', line 40

def info(logger, message)
  # do nothing
end

#is_debugObject



28
29
30
# File 'lib/logger_facade/plugins/airbrake.rb', line 28

def is_debug
  false
end

#trace(logger, message) ⇒ Object



32
33
34
# File 'lib/logger_facade/plugins/airbrake.rb', line 32

def trace(logger, message)
  # do nothing
end

#warn(logger, message) ⇒ Object



44
45
46
# File 'lib/logger_facade/plugins/airbrake.rb', line 44

def warn(logger, message)
  # do nothing
end