Module: Dr::Logger
Constant Summary collapse
- @@logger_options =
{ :info => "info", :warn => "warn", :err => "err", :debug => "debug" }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.log(level, msg) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/dr/logger.rb', line 83 def self.log(level, msg) out = "dr".style("log-head") << " " case level when :info then out << "info".style(@@logger_options[:info]) when :warn then out << "WARN".style(@@logger_options[:warn]) when :err then out << "ERR!".style(@@logger_options[:err]) when :debug then out << "dbg?".style(@@logger_options[:debug]) end out << " " << msg.chomp puts out STDOUT.flush end |