class Statistrano::Log::DefaultLogger
Error, Warning and Message Logging
Public Instance Methods
error(*msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 27 def error *msg status, msg = extract_status "error", *msg to_stderr status, :red, *msg end
Also aliased as: fatal
info(*msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 8 def info *msg status, msg = extract_status "", *msg case status when :success then color = :green else color = :bright end to_stdout status, color, *msg end
Also aliased as: debug
warn(*msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 22 def warn *msg status, msg = extract_status "warning", *msg to_stdout status, :yellow, *msg end
Private Instance Methods
extract_status(default, *msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 35 def extract_status default, *msg if msg.first.is_a? Symbol status = msg.shift else status = default end [status, msg] end
to_stderr(status, color, *msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 49 def to_stderr status, color, *msg $stderr.puts "#{Formatter.new(status, color, *msg).output}" $stderr.flush end
to_stdout(status, color, *msg)
click to toggle source
# File lib/statistrano/log/default_logger.rb, line 44 def to_stdout status, color, *msg $stdout.puts "#{Formatter.new(status, color, *msg).output}" $stdout.flush end