lib/leap_cli/logger.rb in leap_cli-1.5.6 vs lib/leap_cli/logger.rb in leap_cli-1.6.2
- old
+ new
@@ -82,10 +82,23 @@
##
## FORMATTING
##
+ #
+ # options for formatters:
+ #
+ # :match => regexp for matching a log line
+ # :color => what color the line should be
+ # :style => what style the line should be
+ # :priority => what order the formatters are applied in. higher numbers first.
+ # :match_level => only apply filter at the specified log level
+ # :level => make this line visible at this log level or higher
+ # :replace => replace the matched text
+ # :exit => force the exit code to be this (does not interrupt program, just
+ # ensures a specific exit code when the program eventually exits)
+ #
@formatters = [
# TRACE
{ :match => /command finished/, :color => :white, :style => :dim, :match_level => 3, :priority => -10 },
{ :match => /executing locally/, :color => :yellow, :match_level => 3, :priority => -20 },
@@ -136,11 +149,15 @@
{ :match => /^Puppet apply complete.*fail/, :level => 0, :color => :red, :priority => -1, :exit => 1},
# TESTS
{ :match => /^PASS: /, :color => :green, :priority => -20},
{ :match => /^(FAIL|ERROR): /, :color => :red, :priority => -20},
- { :match => /^SKIP: /, :color => :yellow, :priority => -20}
+ { :match => /^(SKIP|WARN): /, :color => :yellow, :priority => -20},
+ { :match => /\d+ tests: \d+ passes, \d+ skips, 0 warnings, 0 failures, 0 errors/, :color => :blue, :priority => -20},
+ # LOG SUPPRESSION
+ { :match => /^warning: You cannot collect without storeconfigs being set/, :level => 2, :priority => 10},
+ { :match => /^warning: You cannot collect exported resources without storeconfigs being set/, :level => 2, :priority => 10}
]
def self.sorted_formatters
# Sort matchers in reverse order so we can break if we found a match.
@sorted_formatters ||= @formatters.sort_by { |i| -(i[:priority] || i[:prio] || 0) }