Module: ConsoleLogger

Defined in:
lib/console_logger.rb

Overview

Provides a Logger customised for console output.

Defined Under Namespace

Classes: Formatter

Class Method Summary collapse

Class Method Details

.new(dest = $stderr, verbose = false) ⇒ Object

Returns a new Logger, customised for console output.

dest - the IO stream to write to verbose - sets log-level to DEBUG, if true



12
13
14
15
16
17
# File 'lib/console_logger.rb', line 12

def self.new(dest = $stderr, verbose = false)
  ::Logger.new(dest).tap do |logger|
    logger.formatter = Formatter.new
    logger.level = verbose ? ::Logger::DEBUG : ::Logger::INFO
  end
end