Ejemplo n.º 1
0
 def write(self, data):
     """
     Write some data to the file.
     """
     BaseLogFile.write(self, data)
     # Guard against a corner case where time.time()
     # could potentially run backwards to yesterday.
     # Primarily due to network time.
     self.lastDate = max(self.lastDate, self.toDate())
Ejemplo n.º 2
0
    def __init__(self, name, directory, defaultMode=None,
                                                     maxRotatedFiles=None):
        """
        Create a log file rotating on length.

        @param name: file name.
        @type name: C{str}
        @param directory: path of the log file.
        @type directory: C{str}
        @param defaultMode: mode used to create the file.
        @type defaultMode: C{int}
        @param maxRotatedFiles: if not None, max number of log files the class
            creates. Warning: it removes all log files above this number.
        @type maxRotatedFiles: C{int}
        """
        BaseLogFile.__init__(self, name, directory, defaultMode)
        self.maxRotatedFiles = maxRotatedFiles
Ejemplo n.º 3
0
 def __init__(self, name, directory, defaultMode=None):
     self.basePath = os.path.join(directory, name)
     BaseLogFile.__init__(self, name, directory, defaultMode)
     self.lastPath = self.path
Ejemplo n.º 4
0
 def _openFile(self):
     BaseLogFile._openFile(self)
     self.lastDate = self.toDate(os.stat(self.path)[8])
Ejemplo n.º 5
0
 def __getstate__(self):
     state = BaseLogFile.__getstate__(self)
     del state["lastDate"]
     return state