useful-scripts/pyutil/pygtail.py
def _check_rotated_filename_candidates(self):
        """
        Check for various rotated logfile filename patterns and return the first
        match we find.
        """
        # savelog(8)
        candidate = "%s.0" % self.filename
        if (exists(candidate) and exists("%s.1.gz" % self.filename) and
            (stat(candidate).st_mtime > stat("%s.1.gz" % self.filename).st_mtime)):
            return candidate

        # logrotate(8)
        # with delaycompress
        candidate = "%s.1" % self.filename
        if exists(candidate):
            return candidate

        # without delaycompress
        candidate = "%s.1.gz" % self.filename
        if exists(candidate):
            return candidate

        rotated_filename_patterns = (
            # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + with `delaycompress`
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
            # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + without `delaycompress`
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
            # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + with `delaycompress`
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
            # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + without `delaycompress`
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
            # for TimedRotatingFileHandler
            ".[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]",
        )
        for rotated_filename_pattern in rotated_filename_patterns:
            candidates = glob.glob(self.filename + rotated_filename_pattern)
            if candidates:
                candidates.sort()
                return candidates[-1]  # return most recent

        # no match
        return None

        Check for various rotated logfile filename patterns and return the first
        match we find.
        
Check for various rotated logfile filename patterns and return the first
match we find.
Check for various rotated logfile filename patterns and return the first match we find .
def _check_rotated_filename_candidates(self):
        candidate = "%s.0" % self.filename
        if (exists(candidate) and exists("%s.1.gz" % self.filename) and
            (stat(candidate).st_mtime > stat("%s.1.gz" % self.filename).st_mtime)):
            return candidate
        candidate = "%s.1" % self.filename
        if exists(candidate):
            return candidate
        candidate = "%s.1.gz" % self.filename
        if exists(candidate):
            return candidate
        rotated_filename_patterns = (
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
            "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
            ".[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]",
        )
        for rotated_filename_pattern in rotated_filename_patterns:
            candidates = glob.glob(self.filename + rotated_filename_pattern)
            if candidates:
                candidates.sort()
                return candidates[-1]  
        return None
def _check_rotated_filename_candidates ( self ) : candidate = "%s.0" % self . filename if ( exists ( candidate ) and exists ( "%s.1.gz" % self . filename ) and ( stat ( candidate ) . st_mtime > stat ( "%s.1.gz" % self . filename ) . st_mtime ) ) : return candidate candidate = "%s.1" % self . filename if exists ( candidate ) : return candidate candidate = "%s.1.gz" % self . filename if exists ( candidate ) : return candidate rotated_filename_patterns = ( "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" , "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz" , "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" , "-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz" , ".[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" , ) for rotated_filename_pattern in rotated_filename_patterns : candidates = glob . glob ( self . filename + rotated_filename_pattern ) if candidates : candidates . sort ( ) return candidates [ - 1 ] return None
Check for various rotated logfile filename patterns and return the first
match we find.
Check for various rotated logfile filename patterns and return the first match we find .
"""
        Check for various rotated logfile filename patterns and return the first
        match we find.
        """ # savelog(8) # logrotate(8) # with delaycompress # without delaycompress # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + with `delaycompress` # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + without `delaycompress` # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + with `delaycompress` # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + without `delaycompress` # for TimedRotatingFileHandler # return most recent # no match
self