parameters: (self, days)
docstring: Purge all log files older than n days
          @param days: number of days
docstring_summary: Purge all log files older than n days
          @param days: number of days
docstring_tokens: Purge all log files older than n days @param days : number of days
function: def PurgeOldLogs(self, days):
          """Purge all log files older than n days
          @param days: number of days
  
          """
          logpattern = re.compile("%s_[0-9]{4}_[0-9]{1,2}_[0-9]{1,2}.log" % self.prefix)
          paths = list()
          cdate = datetime.date(*time.localtime()[:3])
          for path in os.listdir(self.logdir):
              if logpattern.match(path):
                  ymd = [int(x) for x in path[len(self.prefix)+1:-4].split('_')]
                  fdate = datetime.date(*ymd)
                  span = cdate - fdate
                  if span.days > days:
                      fpath = os.path.join(self.logdir, path)
                      paths.append(fpath)
  
          # Attempt to cleanup the old files
          for log in paths:
              try:
                  os.remove(log)
              except OSError:
                  pass
function_tokens: def PurgeOldLogs ( self , days ) : logpattern = re . compile ( "%s_[0-9]{4}_[0-9]{1,2}_[0-9]{1,2}.log" % self . prefix ) paths = list ( ) cdate = datetime . date ( * time . localtime ( ) [ : 3 ] ) for path in os . listdir ( self . logdir ) : if logpattern . match ( path ) : ymd = [ int ( x ) for x in path [ len ( self . prefix ) + 1 : - 4 ] . split ( '_' ) ] fdate = datetime . date ( * ymd ) span = cdate - fdate if span . days > days : fpath = os . path . join ( self . logdir , path ) paths . append ( fpath ) # Attempt to cleanup the old files for log in paths : try : os . remove ( log ) except OSError : pass