Package Ganga :: Package Utility :: Package external :: Package logging :: Module handlers :: Class TimedRotatingFileHandler
[hide private]
[frames] | no frames]

Class TimedRotatingFileHandler

source code

Filterer --+                
           |                
     Handler --+            
               |            
   StreamHandler --+        
                   |        
         FileHandler --+    
                       |    
     BaseRotatingHandler --+
                           |
                          TimedRotatingFileHandler

Handler for logging to a file, rotating the log file at certain timed intervals.

If backupCount is > 0, when rollover is done, no more than backupCount files are kept - the oldest ones are deleted.

Instance Methods [hide private]
 
__init__(self, filename, when='h', interval=1, backupCount=0)
Use the specified filename for streamed logging
source code
 
shouldRollover(self, record)
Determine if rollover should occur
source code
 
doRollover(self)
do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens.
source code

Inherited from BaseRotatingHandler: emit

Inherited from FileHandler: close

Inherited from StreamHandler: flush

Inherited from Handler: acquire, createLock, format, handle, handleError, release, setFormatter, setLevel

Inherited from Filterer: addFilter, filter, removeFilter

Method Details [hide private]

__init__(self, filename, when='h', interval=1, backupCount=0)
(Constructor)

source code 

Use the specified filename for streamed logging

Overrides: Filterer.__init__
(inherited documentation)

shouldRollover(self, record)

source code 

Determine if rollover should occur

record is not used, as we are just comparing times, but it is needed so the method siguratures are the same

doRollover(self)

source code 

do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix.