Module: Sherlog

Defined in:
lib/sherlog_holmes/entry.rb,
lib/sherlog_holmes.rb,
lib/sherlog_holmes/filter.rb,
lib/sherlog_holmes/parser.rb,
lib/sherlog_holmes/result.rb,
lib/sherlog_holmes/version.rb,
lib/sherlog_holmes/listeners/count_listener.rb,
lib/sherlog_holmes/listeners/print_listener.rb,
lib/sherlog_holmes/listeners/occurrence_listener.rb

Overview

The MIT License

Copyright © 2015 Marcelo “Ataxexe” Guimarães <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Classes: CountListener, Entry, Filter, OccurrenceListener, Parser, ParserProcess, PrintListener, Result

Constant Summary collapse

PATTERNS =
{}
VERSION =
'0.6.1'

Class Method Summary collapse

Class Method Details

.load_patterns(file) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/sherlog_holmes.rb', line 39

def self.load_patterns(file)
  patterns = YAML::load_file file
  patterns.each do |id, config|
    pattern_config = {}
    pattern_config[:entry] = Regexp::new(config['entry']) if config['entry']
    pattern_config[:exception] = Regexp::new(config['exception']) if config['exception']
    pattern_config[:stacktrace] = Regexp::new(config['stacktrace']) if config['stacktrace']
    pattern_config = PATTERNS[config['from'].to_sym].merge pattern_config if config['from']
    PATTERNS[id.to_sym] = pattern_config
  end
end

.loaded_patternsObject



63
64
65
# File 'lib/sherlog_holmes.rb', line 63

def self.loaded_patterns
  PATTERNS
end

.parser(pattern_id) ⇒ Object



59
60
61
# File 'lib/sherlog_holmes.rb', line 59

def self.parser(pattern_id)
  Parser::new PATTERNS[pattern_id.to_sym]
end