Sha256: 5bc92d2bca0e3c9f4eae713feb577028d96e7a08829d09af5343ab9c3c922047
Contents?: true
Size: 885 Bytes
Versions: 19
Compression:
Stored size: 885 Bytes
Contents
module MessageLogger def self.included(base) base.extend(ClassMethods) end module ClassMethods def log(msg, options = {}) logmsg(msg, $stdout, options) end def errorlog(msg, options = {}) logmsg(msg, $stderr, options) end private def logmsg(msg, output, options) return if @options and @options[:silent] == true unless (@options and @options[:nocolor] == true) case options[:color] when :blue output << "\033[0;36m#{msg}#{"\033[0m" if options[:clear]}" when :bluebold output << "\033[1;36m#{msg}#{"\033[0m" if options[:clear]}" when :red output << "\033[0;31m#{msg}#{"\033[0m" if options[:clear]}" when :green output << "\033[0;32m#{msg}#{"\033[0m" if options[:clear]}" end else output << msg end end end end
Version data entries
19 entries across 19 versions & 1 rubygems