Class: OneLineLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/cloud_runner/one_line_logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ OneLineLogger

Returns a new instance of OneLineLogger.



4
5
6
7
# File 'lib/cloud_runner/one_line_logger.rb', line 4

def initialize(*args)
  super
  customize_formatter
end

Instance Method Details

#customize_formatterObject



9
10
11
12
13
14
15
16
17
# File 'lib/cloud_runner/one_line_logger.rb', line 9

def customize_formatter
  last_line_len = 0
  self.formatter = proc do |severity, datetime, progname, msg|
    line = msg.split("\n").last
    "\r#{" " * last_line_len}\r#{line}".tap do
      last_line_len = line.size
    end
  end
end