Class: Rollbar::LoggerProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar/logger_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ LoggerProxy

Returns a new instance of LoggerProxy.



5
6
7
# File 'lib/rollbar/logger_proxy.rb', line 5

def initialize(object)
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



3
4
5
# File 'lib/rollbar/logger_proxy.rb', line 3

def object
  @object
end

Instance Method Details

#debug(message) ⇒ Object



9
10
11
# File 'lib/rollbar/logger_proxy.rb', line 9

def debug(message)
  log('debug', message)
end

#error(message) ⇒ Object



21
22
23
# File 'lib/rollbar/logger_proxy.rb', line 21

def error(message)
  log('error', message)
end

#info(message) ⇒ Object



13
14
15
# File 'lib/rollbar/logger_proxy.rb', line 13

def info(message)
  log('info', message)
end

#log(level, message) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/rollbar/logger_proxy.rb', line 25

def log(level, message)
  unless Rollbar.configuration.enabled && acceptable_levels.include?(level.to_sym)
    return
  end

  @object.send(level, message)
rescue StandardError
  puts "[Rollbar] Error logging #{level}:"
  puts "[Rollbar] #{message}"
end

#warn(message) ⇒ Object



17
18
19
# File 'lib/rollbar/logger_proxy.rb', line 17

def warn(message)
  log('warn', message)
end