Description:
[grader] raise when log directory does not exist git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@108 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r25:8541b6e657f1 - - 1 file changed: 3 inserted, 0 deleted

@@ -15,24 +15,27
15 15
16 16 def clear_stopfile
17 17 if FileTest.exist?(File.dirname(__FILE__) + "/stop.#{Process.pid}")
18 18 system("rm " + File.dirname(__FILE__) + "/stop.#{Process.pid}")
19 19 end
20 20 end
21 21
22 22 def config
23 23 Grader::Configuration.get_instance
24 24 end
25 25
26 26 def log_file_name
27 + if !File.exists?(config.log_dir)
28 + raise "Log directory does not exist: #{config.log_dir}"
29 + end
27 30 config.log_dir +
28 31 "/#{GRADER_ENV}_#{config.grader_mode}.#{Process.pid}"
29 32 end
30 33
31 34 def log(str)
32 35 if config.talkative
33 36 puts str
34 37 end
35 38 if config.logging
36 39 fp = File.open(log_file_name,"a")
37 40 fp.puts("GRADER: #{Time.new.strftime("%H:%M")} #{str}")
38 41 fp.close
You need to be logged in to leave comments. Login now