Class: DCA::Helpers::VerboseLogger
- Inherits:
-
Logger
- Object
- Logger
- DCA::Helpers::VerboseLogger
- Defined in:
- lib/dca/helpers/logger.rb
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil, &block) ⇒ Object
- #exception(error, progname = nil, &block) ⇒ Object
-
#initialize(logdev, shift_age = 0, shift_size = 1048576, verbose = false) ⇒ VerboseLogger
constructor
A new instance of VerboseLogger.
Constructor Details
#initialize(logdev, shift_age = 0, shift_size = 1048576, verbose = false) ⇒ VerboseLogger
Returns a new instance of VerboseLogger.
5 6 7 8 9 |
# File 'lib/dca/helpers/logger.rb', line 5 def initialize(logdev, shift_age = 0, shift_size = 1048576, verbose = false) super logdev, shift_age, shift_size @verbose_logdev = LogDevice.new(STDOUT, :shift_age => shift_age, :shift_size => shift_size) if verbose @default_logdev = @logdev end |
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/dca/helpers/logger.rb', line 11 def add(severity, = nil, progname = nil, &block) super severity, , progname, &block if @verbose_logdev @logdev = @verbose_logdev super severity, , progname, &block @logdev = @default_logdev end end |
#exception(error, progname = nil, &block) ⇒ Object
21 22 23 |
# File 'lib/dca/helpers/logger.rb', line 21 def exception(error, progname = nil, &block) add(FATAL, "#{error.}\n#{error.backtrace.join("\n")}", progname, &block) end |