Sha256: 95275ea09e150e8c8ea350d57a7ca1afd5aa1a22482d6454f8b407af25c4161d
Contents?: true
Size: 792 Bytes
Versions: 4
Compression:
Stored size: 792 Bytes
Contents
class Gratan::Logger < ::Logger include Singleton def initialize super($stdout) self.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end self.level = Logger::INFO end def set_debug(value) self.level = value ? Logger::DEBUG : Logger::INFO end module Helper def log(level, message, options = {}) global_options = @options || {} message = "[#{level.to_s.upcase}] #{message}" unless level == :info if global_options[:dry_run] and options[:dry_run] != false message << ' (dry-run)' if global_options[:dry_run] end message = message.send(options[:color]) if options[:color] logger = global_options[:logger] || Gratan::Logger.instance logger.send(level, message) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gratan-0.1.7 | lib/gratan/logger.rb |
gratan-0.1.6 | lib/gratan/logger.rb |
gratan-0.1.5 | lib/gratan/logger.rb |
gratan-0.1.4 | lib/gratan/logger.rb |