Class: Kitchen::Logger::StreamLineFormatter
- Inherits:
-
Object
- Object
- Kitchen::Logger::StreamLineFormatter
- Defined in:
- lib/kitchen/logger.rb
Overview
Rewrites already-prefixed stream lines into the matching logger call.
Instance Method Summary collapse
- #format(line) ⇒ Object
-
#initialize(logger) ⇒ StreamLineFormatter
constructor
A new instance of StreamLineFormatter.
Constructor Details
#initialize(logger) ⇒ StreamLineFormatter
Returns a new instance of StreamLineFormatter.
469 470 471 |
# File 'lib/kitchen/logger.rb', line 469 def initialize(logger) @logger = logger end |
Instance Method Details
#format(line) ⇒ Object
473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/kitchen/logger.rb', line 473 def format(line) case line when /^-----> / then log_line(:banner, line.gsub(/^[ >-]{6} /, "")) when /^D / then structured_line(:debug, line.gsub(/^D {6}/, ""), line) when /^\$\$\$\$\$\$ / then structured_line(:warn, line.gsub(/^\${6} /, ""), line) when /^>>>>>> / then log_line(:error, line.gsub(/^[ >-]{6} /, "")) when /^!!!!!! / then structured_line(:fatal, line.gsub(/^!{6} /, ""), line) when /^ / then log_line(:info, line.gsub(/^[ >-]{6} /, "")) else log_line(:info, line) end end |