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
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/dr/logger.rb', line 57 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 |