Author |
Al Kivi <admin@viztrax.com> |
License |
MIT |
add more format directives here..
The symbols are used to map the log to the env variables The regex is used when checking what format the log is and to extract data
# File lib/vizi/parser.rb, line 46 def parse_format(format) format_directive = /%(.*?)(\{.*?\})?([#{[DIRECTIVES.keys.join('|')]}])([\s\\"]*)/ log_format_symbols = [] format_regex = "" format.scan(format_directive) do |condition, subdirective, directive_char, ignored| log_format, match_regex = process_directive(directive_char, subdirective, condition) ignored.gsub!(/\s/, '\s') unless ignored.nil? log_format_symbols << log_format format_regex << "(#{match_regex})#{ignored}" end @format_symbols = log_format_symbols @format_regex = /^#{format_regex}/ end
# File lib/vizi/parser.rb, line 60 def process_directive(directive_char, subdirective, condition) directive = DIRECTIVES[directive_char] case directive_char when 'i' log_format = subdirective[1...-1].downcase.tr('-', '_').to_sym [log_format, directive[1].source] else [directive[0], directive[1].source] end end
Generated with the Darkfish Rdoc Generator 2.