Skip to content

Commit

Permalink
Fix logging the number of imported items
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed May 17, 2017
1 parent 1e969d6 commit aa11138
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/bbmb/util/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
# Util::Updater -- bbmb.ch -- 14.09.2006 -- hwyss@ywesee.com

require 'bbmb'
require 'sbsm/logger'
require 'bbmb/util/polling_manager'

module BBMB
module Util
module Updater
def Updater.run
SBSM.info "Updated.run started at #{Time.now}"
PollingManager.new.poll_sources do |filename, io|
importer, *args = BBMB.config.importers[filename]
if(importer)
Expand All @@ -17,8 +19,9 @@ def Updater.run
end
def Updater.import(importer, args, io)
klass = Util.const_get(importer)
SBSM.info("Updater.import using klass #{klass}")
count = klass.new(*args).import(io)
SBSM.info('updater') { sprintf("%s imported %i entities", importer.class, (count && count.defined?(:to_i)) ? count.to_i : 0) }
SBSM.info("updater #{importer.class} imported #{count.is_a?(Integer) ? count : 0} entities")
end
end
end
Expand Down

0 comments on commit aa11138

Please sign in to comment.