Class: DLogger

Inherits:
Logger show all
Defined in:
lib/d_logger.rb

Overview

This Logger subclass permit to use more debug levels

log = DLogger.new(STDERR) log.level = -1 log.debug1 “You see me” log.debug2 “You see me” log.debug3 “You don’t see me”

Constant Summary collapse

Format =
"%s, [%s#%d] %6s -- %s: %s\n"

Instance Method Summary collapse

Methods included from LoggerObserver

#update

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, progname = nil, *args, &block) ⇒ Object



26
27
28
29
# File 'lib/d_logger.rb', line 26

def method_missing ( meth, progname=nil, *args, &block )
  return super unless meth.to_s =~ /^debug(\d+)$/ or !args.empty
  add(-$1.to_i + 1, nil, progname, &block)
end