Class: Empezar::EchoingFormatter
- Inherits:
-
Object
- Object
- Empezar::EchoingFormatter
- Defined in:
- lib/empezar/echoing_formatter.rb
Instance Attribute Summary collapse
-
#stdout ⇒ Object
Returns the value of attribute stdout.
-
#wrapee ⇒ Object
Returns the value of attribute wrapee.
Instance Method Summary collapse
- #call(severity, datetime, progname, message) ⇒ Object
-
#initialize(wrapee, stdout) ⇒ EchoingFormatter
constructor
A new instance of EchoingFormatter.
Constructor Details
#initialize(wrapee, stdout) ⇒ EchoingFormatter
Returns a new instance of EchoingFormatter.
5 6 7 8 |
# File 'lib/empezar/echoing_formatter.rb', line 5 def initialize wrapee, stdout @wrapee = wrapee @stdout = stdout end |
Instance Attribute Details
#stdout ⇒ Object
Returns the value of attribute stdout.
3 4 5 |
# File 'lib/empezar/echoing_formatter.rb', line 3 def stdout @stdout end |
#wrapee ⇒ Object
Returns the value of attribute wrapee.
3 4 5 |
# File 'lib/empezar/echoing_formatter.rb', line 3 def wrapee @wrapee end |
Instance Method Details
#call(severity, datetime, progname, message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/empezar/echoing_formatter.rb', line 10 def call severity, datetime, progname, case severity when Logger::Severity::FATAL, "FATAL" @stdout.puts Term::ANSIColor.bold Term::ANSIColor.red when Logger::Severity::ERROR, "ERROR" @stdout.puts Term::ANSIColor.red when Logger::Severity::WARN, "WARN" @stdout.puts Term::ANSIColor.yellow when Logger::Severity::INFO, "INFO" @stdout.puts Term::ANSIColor.blue when Logger::Severity::DEBUG, "DEBUG" @stdout.puts Term::ANSIColor.dark when Logger::Severity::UNKNOWN, "UNKNOWN" @stdout.puts end wrapee.call severity, datetime, progname, end |