equal
deleted
inserted
replaced
34 from optparse import OptionParser |
34 from optparse import OptionParser |
35 |
35 |
36 |
36 |
37 |
37 |
38 |
38 |
39 """ Log scanner for filter logs |
39 """ plugin that gets copied to raptor folder so that wehn raptor (SBS) runs it |
|
40 knows the format of the log files. |
40 """ |
41 """ |
41 class FilterHeliumLog(filter_interface.Filter): |
42 class FilterHeliumLog(filter_interface.Filter): |
42 |
43 """ Log scanner for filter logs""" |
43 def open(self, raptor_instance): |
44 def open(self, raptor_instance): |
44 """Open a log file for the various I/O methods to write to.""" |
45 """Open a log file for the various I/O methods to write to.""" |
45 self.raptor = raptor_instance |
46 self.raptor = raptor_instance |
46 self.logFileName = self.raptor.logFileName |
47 self.logFileName = self.raptor.logFileName |
47 self.scanlog = SBSScanlog() |
48 self.scanlog = SBSScanlog() |
53 |
54 |
54 try: |
55 try: |
55 dirname = str(self.raptor.logFileName.Dir()) |
56 dirname = str(self.raptor.logFileName.Dir()) |
56 if dirname and not os.path.isdir(dirname): |
57 if dirname and not os.path.isdir(dirname): |
57 os.makedirs(dirname) |
58 os.makedirs(dirname) |
58 except Exception, e: |
59 except Exception, e_error: |
59 return False |
60 return False |
60 return self.scanlog.initialize(self.logFileName) |
61 return self.scanlog.initialize(self.logFileName) |
61 else: |
62 else: |
62 self.out = sys.stdout |
63 self.out = sys.stdout |
63 |
64 |
64 return True |
65 return True |
65 |
66 |
66 def write(self, text): |
67 def write(self, text): |
|
68 """write text to the open file""" |
67 return self.scanlog.write(text) |
69 return self.scanlog.write(text) |
68 |
70 |
69 def summary(self): |
71 def summary(self): |
|
72 """write the summary log file""" |
70 return self.scanlog.summary() |
73 return self.scanlog.summary() |
71 |
74 |
72 def close(self): |
75 def close(self): |
|
76 """close the log file""" |
73 return self.scanlog.close() |
77 return self.scanlog.close() |