lib/empezar/echoing_formatter.rb in empezar-0.2.0 vs lib/empezar/echoing_formatter.rb in empezar-0.3.0
- old
+ new
@@ -1,26 +1,27 @@
module Empezar
class EchoingFormatter
- attr_accessor :wrapee
+ attr_accessor :wrapee, :stdout
- def initialize wrapee
+ def initialize wrapee, stdout
@wrapee = wrapee
+ @stdout = stdout
end
def call severity, datetime, progname, message
case severity
when Logger::Severity::FATAL, "FATAL"
- $stdout.puts Term::ANSIColor.bold Term::ANSIColor.red message
+ @stdout.puts Term::ANSIColor.bold Term::ANSIColor.red message
when Logger::Severity::ERROR, "ERROR"
- $stdout.puts Term::ANSIColor.red message
+ @stdout.puts Term::ANSIColor.red message
when Logger::Severity::WARN, "WARN"
- $stdout.puts Term::ANSIColor.yellow message
+ @stdout.puts Term::ANSIColor.yellow message
when Logger::Severity::INFO, "INFO"
- $stdout.puts Term::ANSIColor.blue message
+ @stdout.puts Term::ANSIColor.blue message
when Logger::Severity::DEBUG, "DEBUG"
- $stdout.puts Term::ANSIColor.dark message
+ @stdout.puts Term::ANSIColor.dark message
when Logger::Severity::UNKNOWN, "UNKNOWN"
- $stdout.puts message
+ @stdout.puts message
end
wrapee.call severity, datetime, progname, message
end
end
\ No newline at end of file