[title] Fixed parsing about log
authordibs <dibs@samsung.com>
Fri, 29 Mar 2013 07:28:46 +0000 (16:28 +0900)
committerdibs <dibs@samsung.com>
Fri, 29 Mar 2013 07:28:46 +0000 (16:28 +0900)
src/build_server/JobLog.rb

index 488c4d1852446e59d1a323dbdf807779109ff029..c32064a859865679bebd028d3789d8cfa6bf019e 100644 (file)
@@ -49,13 +49,26 @@ class JobLog < Log
 
 
        def JobLog.parse_log(line)
-               line = line.sub(/^[a-zA-Z], \[.*\][ \t]*/,"")
-               linetok = line.split(" -- : ")
-               if linetok.count != 2 then return "INFO", 1, "" end
-               category = linetok[0]
-               line = linetok[1]
-               level = line[1..1].to_i
-               contents = line[4..-1]
+               data = line.sub(/(^[a-zA-Z], \[[^\]]*\][ \t]*)/,"")                                     
+               if $1.nil? then
+                       return "UNKNOWN", 1, line
+               end
+
+               data_tok = data.split(" -- : ")
+               if data_tok.nil? then 
+                       return "UNKNOWN", 1, line
+               elsif data_tok.count != 2 then 
+                       return "INFO", 1, "" 
+               end
+
+               category = data_tok[0]
+               sub_data = data_tok[1]
+               level = sub_data[1..1].to_i
+               contents = sub_data[4..-1]
+
+               if contents.nil? then
+                       contents = ""
+               end
 
                return category, level, contents
        end