Skip to content

Commit

Permalink
Fix log log location. Return false if no update
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Jan 23, 2014
1 parent 027e7c3 commit dd29860
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugin/swissmedic.rb
Expand Up @@ -41,7 +41,7 @@ def initialize(app=nil, archive=ARCHIVE_PATH)
def debug_msg(msg)
# $stdout.puts Time.now.to_s + ': ' + msg; $stdout.flush
if not defined?(@checkLog) or not @checkLog
name = LogFile.filename(File.basename(__FILE__), Time.now)
name = LogFile.filename('oddb/debug/'+File.basename(__FILE__), Time.now)
FileUtils.makedirs(File.dirname(name))
@checkLog = File.open(name, 'a+')
$stdout.puts "Opened #{name}"
Expand Down Expand Up @@ -92,7 +92,8 @@ def update(agent=Mechanize.new, target=get_latest_file(agent))
memo
}
else
debug_msg "#{__FILE__}: #{__LINE__} update skipped as target is #{target.inspect}"
debug_msg "#{__FILE__}: #{__LINE__} update return false as target is #{target.inspect}"
false
end
end
# check diff from overwritten stored-objects by admin
Expand Down Expand Up @@ -262,7 +263,7 @@ def get_latest_file(agent, keyword='Packungen', extension = '.xlsx')
target
else
debug_msg "#{__FILE__}: #{__LINE__} skip writing #{target} as #{latest_name} is #{File.size(latest_name)} bytes. Returning latest"
latest_name
nil
end
end
def initialize_export_registrations(agent)
Expand Down

0 comments on commit dd29860

Please sign in to comment.