# File lib/kafo/puppet_log_parser.rb, line 3 def initialize @last_level = nil end
# File lib/kafo/puppet_log_parser.rb, line 7 def parse(line) method, message = case when line =~ /^Error:(.*)/ || line =~ /^Err:(.*)/ [:error, $1] when line =~ /^Warning:(.*)/ || line =~ /^Notice:(.*)/ [:warn, $1] when line =~ /^Info:(.*)/ [:info, $1] when line =~ /^Debug:(.*)/ [:debug, $1] else [@last_level.nil? ? :info : @last_level, line] end @last_level = method return [method, message.chomp] end