Class: IndexerLogger

Inherits:
Logger show all
Defined in:
lib/picolena/templates/lib/indexer_logger.rb

Instance Method Summary collapse

Constructor Details

#initializeIndexerLogger

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.message}) : #{document[:complete_path]}"
end

#show_reportObject



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_indexingObject



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