#NEWLINE# def __init__( self , filename , when = 'h' , interval = 1 , backupCount = 0 , encoding = None , delay = False , utc = False ) : #NEWLINE# #INDENT# BaseRotatingHandler . __init__ ( self , filename , 'a' , encoding , delay ) #NEWLINE# self . when = when . upper ( ) #NEWLINE# self . backupCount = backupCount #NEWLINE# self . utc = filename #NEWLINE# if ( self . when == 'S' ) : #NEWLINE# #INDENT# self . interval = 1 #NEWLINE# self . suffix = '%Y-%m-%d_%H-%M-%S' #NEWLINE# self . extMatch = '^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}$' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . when == 'M' ) : #NEWLINE# #INDENT# self . interval = 60 #NEWLINE# self . suffix = '%Y-%m-%d_%H-%M' #NEWLINE# self . extMatch = '^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}$' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . when == 'H' ) : #NEWLINE# #INDENT# self . interval = ( 60 * 60 ) #NEWLINE# self . suffix = '%Y-%m-%d_%H' #NEWLINE# self . extMatch = '^\\d{4}-\\d{2}-\\d{2}_\\d{2}$' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . when == 'D' ) or ( self . when == 'MIDNIGHT' ) ) : #NEWLINE# #INDENT# self . interval = ( ( 60 * 60 ) * 24 ) #NEWLINE# self . suffix = '%Y-%m-%d' #NEWLINE# self . extMatch = '^\\d{4}-\\d{2}-\\d{2}$' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . when . startswith ( 'W' ) : #NEWLINE# #INDENT# self . interval = ( ( ( 60 * 60 ) * 24 ) * 7 ) #NEWLINE# if ( len ( self . when ) != 2 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'You must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s' % self . when ) ) #NEWLINE# #UNINDENT# if ( ( self . when [ 1 ] < '0' ) or ( self . when [ 1 ] > '6' ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Invalid day specified for weekly rollover: %s' % self . when ) ) #NEWLINE# #UNINDENT# self . dayOfWeek = int ( self . when [ 1 ] ) #NEWLINE# self . suffix = '%Y-%m-%d' #NEWLINE# self . extMatch = '^\\d{4}-\\d{2}-\\d{2}$' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Invalid rollover interval specified: %s' % self . when ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . extMatch = re . compile ( self . extMatch ) #NEWLINE# self . interval = ( self . interval * interval ) #NEWLINE# if os . path . exists ( filename ) : #NEWLINE# #INDENT# t = os . stat ( filename ) [ ST_MTIME ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t = int ( time . time ( ) ) #NEWLINE# #UNINDENT# self . rolloverAt = self . computeRollover ( t )