Class: IndexerLogger
- Defined in:
- lib/picolena/templates/lib/indexer_logger.rb
Instance Method Summary collapse
- #add_document(document) ⇒ Object
-
#initialize ⇒ IndexerLogger
constructor
A new instance of IndexerLogger.
- #reject_document(document, error) ⇒ Object
- #show_report ⇒ Object
- #start_indexing ⇒ Object
Constructor Details
#initialize ⇒ IndexerLogger
Returns a new instance of IndexerLogger.
2 3 4 5 6 7 8 |
# File 'lib/picolena/templates/lib/indexer_logger.rb', line 2 def initialize super($stdout) @level=Picolena::LOGLEVEL @found_languages={} @supported_filetypes={} @unsupported_filetypes={} end |
Instance Method Details
#add_document(document) ⇒ Object
15 16 17 18 19 |
# File 'lib/picolena/templates/lib/indexer_logger.rb', line 15 def add_document(document) debug ["Added : #{document[:complete_path]}",document[:language] && " ("<<document[:language]<<")"].join @found_languages.add(document[:language]) if document[:language] @supported_filetypes.add(document[:filetype]) end |
#reject_document(document, error) ⇒ Object
21 22 23 24 |
# File 'lib/picolena/templates/lib/indexer_logger.rb', line 21 def reject_document(document, error) @unsupported_filetypes.add(document[:filetype]) debug "Added without content (#{error.}) : #{document[:complete_path]}" end |
#show_report ⇒ Object
26 27 28 29 |
# File 'lib/picolena/templates/lib/indexer_logger.rb', line 26 def show_report describe :found_languages, :supported_filetypes, :unsupported_filetypes info "Time needed : #{Time.now-@start_time} s." end |
#start_indexing ⇒ Object
10 11 12 13 |
# File 'lib/picolena/templates/lib/indexer_logger.rb', line 10 def start_indexing @start_time=Time.now debug "Indexing every directory" end |