Class: FFWD::ClassLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/ffwd/logging.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ ClassLogger

Returns a new instance of ClassLogger.



85
86
87
# File 'lib/ffwd/logging.rb', line 85

def initialize klass
  @progname = klass.name
end

Instance Method Details

#debug(message) ⇒ Object



93
94
95
# File 'lib/ffwd/logging.rb', line 93

def debug message
  FFWD.log.debug(@progname){message}
end

#debug?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/ffwd/logging.rb', line 89

def debug?
  FFWD.log.debug?
end

#error(message, e = nil) ⇒ Object



105
106
107
108
109
110
111
112
113
114
# File 'lib/ffwd/logging.rb', line 105

def error message, e=nil
  FFWD.log.error(@progname){message}

  return unless e

  FFWD.log.error(@progname){"Caused by #{e.class}: #{e}"}
  e.backtrace.each do |b|
    FFWD.log.error(@progname){"  #{b}"}
  end
end

#info(message) ⇒ Object



97
98
99
# File 'lib/ffwd/logging.rb', line 97

def info message
  FFWD.log.info(@progname){message}
end

#warning(message) ⇒ Object



101
102
103
# File 'lib/ffwd/logging.rb', line 101

def warning message
  FFWD.log.warn(@progname){message}
end