equal
deleted
inserted
replaced
375 dtz = dt.astimezone(self.tz) |
375 dtz = dt.astimezone(self.tz) |
376 |
376 |
377 # convert to date and use that |
377 # convert to date and use that |
378 return self._get_logfile_date(dtz.date()) |
378 return self._get_logfile_date(dtz.date()) |
379 |
379 |
380 def _get_logfile_date (self, d, load=True, stat=False, ignore_missing=True) : |
380 def _get_logfile_date (self, d, load=True, mtime=False, ignore_missing=True) : |
381 """ |
381 """ |
382 Get the logfile corresponding to the given naive date in our timezone. |
382 Get the logfile corresponding to the given naive date in our timezone. |
383 |
383 |
384 If load is False, only test for the presence of the logfile, do not actually open it. If stat is given, |
384 If load is False, only test for the presence of the logfile, do not actually open it. If mtime is given, |
385 then this returns the stat() result |
385 then this returns the file's mtime |
386 |
386 |
387 Returns None if the logfile does not exist, unless ignore_missing is given as False. |
387 Returns None if the logfile does not exist, unless ignore_missing is given as False. |
388 """ |
388 """ |
389 |
389 |
390 # format filename |
390 # format filename |
396 try : |
396 try : |
397 if load : |
397 if load : |
398 # open+return the LogFile |
398 # open+return the LogFile |
399 return LogFile(path, self.parser, self.decoder, start_date=d, channel=self.channel) |
399 return LogFile(path, self.parser, self.decoder, start_date=d, channel=self.channel) |
400 |
400 |
401 elif stat : |
401 elif mtime : |
402 # stat |
402 # stat |
403 return os.stat(path) |
403 return utils.mtime(path) |
404 |
404 |
405 else : |
405 else : |
406 # test |
406 # test |
407 return os.path.exists(path) |
407 return os.path.exists(path) |
408 |
408 |
625 # iterate through all available logfiles in date order, as datetimes, from the given date on |
625 # iterate through all available logfiles in date order, as datetimes, from the given date on |
626 for log_date in self._iter_logfile_dates(after) : |
626 for log_date in self._iter_logfile_dates(after) : |
627 # compare against dt? |
627 # compare against dt? |
628 if dt : |
628 if dt : |
629 # stat |
629 # stat |
630 st = self._get_logfile_date(log_date, load=False, stat=True) |
630 mtime = self._get_logfile_date(log_date, load=False, mtime=True) |
631 |
631 |
632 # not modified? |
632 # not modified? |
633 if utils.from_utc_timestamp(st.st_mtime) < dt : |
633 if mtime < dt : |
634 # skip |
634 # skip |
635 continue |
635 continue |
636 |
636 |
637 # open |
637 # open |
638 logfile = self._get_logfile_date(log_date, ignore_missing=False) |
638 logfile = self._get_logfile_date(log_date, ignore_missing=False) |