Class: Loom::Logger
- Inherits:
-
Object
- Object
- Loom::Logger
- Defined in:
- lib/loom/logger.rb
Defined Under Namespace
Modules: LoggerDebugLevels Classes: Styleizer
Constant Summary collapse
- COLOR_MAP =
{ :d => :green, :i => :blue, :w => :yellow, :e => :red, :f => :pink }
Class Method Summary collapse
Class Method Details
.configure(config) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/loom/logger.rb', line 14 def configure(config) device = configure_device config.log_device logger = ::Logger.new device class << logger include LoggerDebugLevels end raise "missing logger debug methods" unless logger.respond_to? :debug1 logger.level = case config.log_level when Symbol, String ::Logger.const_get config.log_level.to_s.upcase when Integer # Negative numbers can be used for detailed debug levels config.log_level end colorize = config.log_colorize && device.tty? logger.formatter = default_formatter colorize if config.log_colorize && !device.tty? logger.warn "disabled log colorization for non-tty" end logger end |