Class: Build::CompactFormatter
- Inherits:
-
Object
- Object
- Build::CompactFormatter
- Defined in:
- lib/build/logger.rb
Instance Method Summary collapse
- #call(severity, datetime, progname, message) ⇒ Object
- #chdir_string(options) ⇒ Object
- #format_command(arguments) ⇒ Object
-
#initialize ⇒ CompactFormatter
constructor
A new instance of CompactFormatter.
- #time_offset_string ⇒ Object
Constructor Details
#initialize ⇒ CompactFormatter
26 27 28 |
# File 'lib/build/logger.rb', line 26 def initialize @start = Time.now end |
Instance Method Details
#call(severity, datetime, progname, message) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/build/logger.rb', line 57 def call(severity, datetime, progname, ) if progname == 'shell' and Array === "#{time_offset_string}: #{format_command()}\n" else "#{time_offset_string}: #{}\n" end end |
#chdir_string(options) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/build/logger.rb', line 36 def chdir_string() if [:chdir] " in #{[:chdir]}" else "" end end |
#format_command(arguments) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/build/logger.rb', line 44 def format_command(arguments) if arguments.last.is_a? Hash = arguments.last arguments = arguments[0...-1] else = {} end arguments = arguments.flatten.collect &:to_s Rainbow(arguments.join(' ')).blue + chdir_string() end |
#time_offset_string ⇒ Object
30 31 32 33 34 |
# File 'lib/build/logger.rb', line 30 def time_offset_string offset = Time.now - @start "T+#{offset.round(2).to_s.ljust(5)}" end |