]> Frank Brehm's Git Trees - my-stuff/py-logrotate.git/commitdiff
Module LogRotateStatusFile.py weitergemacht
authorFrank Brehm <frank@brehm-online.com>
Sun, 29 May 2011 08:03:50 +0000 (08:03 +0000)
committerFrank Brehm <frank@brehm-online.com>
Sun, 29 May 2011 08:03:50 +0000 (08:03 +0000)
git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@249 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa

LogRotateStatusFile.py

index 6f9084484d3008f726e4cec22ea90dbcdaa70da0..9cd1a6ea85beefc1e6266f9b81b9c32b2fa4da42 100755 (executable)
@@ -45,6 +45,7 @@ class LogrotateStatusFile(object):
     def __init__( self, file_name,
                         local_dir  = None,
                         verbose    = 0,
+                        test_mode  = False,
                         logger     = None,
     ):
         '''
@@ -54,6 +55,8 @@ class LogrotateStatusFile(object):
         @type config_file:  str
         @param verbose:     verbosity (debug) level
         @type verbose:      int
+        @param test_mode:   test mode - no write actions are made
+        @type test_mode:    bool
         @param logger:      logger object to use for logging a.s.o.
         @type logger:       logging.getLogger or None
         @param local_dir:   The directory, where the i18n-files (*.mo)
@@ -94,12 +97,40 @@ class LogrotateStatusFile(object):
         @type: str
         '''
 
+        self.fd = None
+        '''
+        @ivar: the file object of the opened status file, or None, if not opened
+        @type: file or None
+        '''
+
+        self.status_version = None
+        '''
+        @ivar: the version of the status file (2 or 3)
+        @type: int or None
+        '''
+
+        self.test_mode = test_mode
+        '''
+        @ivar: test mode - no write actions are made
+        @type: bool
+        '''
+
         self.logger = logger
         '''
         @ivar: logger object
         @type: logging.getLogger
         '''
 
+        self.file_state = {}
+        '''
+        @ivar: the last rotation date of every particular log file
+               keys are the asolute filenames (without globbing)
+               and the values are datetime objects of the last rotation
+               referencing to UTC
+               If no rotation was made, value is datetime.min().
+        @type: dict
+        '''
+
         if not logger:
 
             #################################################
@@ -128,6 +159,11 @@ class LogrotateStatusFile(object):
             # add ch to logger
             self.logger.addHandler(ch)
 
+    #-------------------------------------------------------
+    def _read(self, must_exists = True):
+
+        pass
+        return True
 
 #========================================================================