equal
deleted
inserted
replaced
37 A file containing LogEvents |
37 A file containing LogEvents |
38 |
38 |
39 XXX: modify to implement LogSource? |
39 XXX: modify to implement LogSource? |
40 """ |
40 """ |
41 |
41 |
42 def __init__ (self, path, parser, start_date=None, charset='utf-8', sep='\n') : |
42 def __init__ (self, path, parser, charset, start_date=None, sep='\n') : |
43 """ |
43 """ |
44 Open the file at the given path, which contains data with the given charset, as lines separated by the |
44 Open the file at the given path, which contains data with the given charset, as lines separated by the |
45 given separator. Lines are parsed using the given parser, using the given date as an initial date, see |
45 given separator. Lines are parsed using the given parser, using the given date as an initial date, see |
46 LogParser for more info. XXX: currently we assume start_date also for the end of the file |
46 LogParser for more info. XXX: currently we assume start_date also for the end of the file |
47 """ |
47 """ |
202 class LogDirectory (LogSource) : |
202 class LogDirectory (LogSource) : |
203 """ |
203 """ |
204 A directory containing a series of timestamped LogFiles |
204 A directory containing a series of timestamped LogFiles |
205 """ |
205 """ |
206 |
206 |
207 def __init__ (self, path, tz, parser, charset='utf-8', filename_fmt='%Y-%m-%d') : |
207 def __init__ (self, path, tz, parser, charset, filename_fmt) : |
208 """ |
208 """ |
209 Load the logfiles at the given path. |
209 Load the logfiles at the given path. |
210 |
210 |
211 The files contain data in the given charset, and are named according the the date in the given timezone and |
211 The files contain data in the given charset, and are named according the the date in the given timezone and |
212 date format, and will be parsed using the given parser. |
212 date format, and will be parsed using the given parser. |
245 path = os.path.join(self.path, filename) |
245 path = os.path.join(self.path, filename) |
246 |
246 |
247 try : |
247 try : |
248 if load : |
248 if load : |
249 # open+return the LogFile |
249 # open+return the LogFile |
250 return LogFile(path, self.parser, d, self.charset) |
250 return LogFile(path, self.parser, self.charset, d) |
251 |
251 |
252 else : |
252 else : |
253 # test |
253 # test |
254 return os.path.exists(path) |
254 return os.path.exists(path) |
255 |
255 |