#NEWLINE# def log_handler( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# _logconf = self . logger #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# handler = None #NEWLINE# for htyp in LOG_HANDLER : #NEWLINE# #INDENT# if ( htyp in _logconf ) : #NEWLINE# #INDENT# if ( htyp == 'syslog' ) : #NEWLINE# #INDENT# args = _logconf [ htyp ] #NEWLINE# if ( 'socktype' in args ) : #NEWLINE# #INDENT# import socket #NEWLINE# if ( args [ 'socktype' ] == 'dgram' ) : #NEWLINE# #INDENT# args [ 'socktype' ] = socket . SOCK_DGRAM #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( htyp [ 'socktype' ] == 'stream' ) : #NEWLINE# #INDENT# args [ 'socktype' ] = socket . SOCK_STREAM #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ConfigurationError ( 'Unknown socktype!' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# handler = LOG_HANDLER [ htyp ] ( ** args ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# del args [ 'socktype' ] #NEWLINE# handler = LOG_HANDLER [ htyp ] ( ** args ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# handler = LOG_HANDLER [ htyp ] ( ** _logconf [ htyp ] ) #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# #UNINDENT# if ( handler is None ) : #NEWLINE# #INDENT# handler = LOG_HANDLER [ 'rotating' ] ( ) #NEWLINE# #UNINDENT# if ( 'format' in _logconf ) : #NEWLINE# #INDENT# formatter = logging . Formatter ( _logconf [ 'format' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# formatter = logging . Formatter ( LOG_FORMAT ) #NEWLINE# #UNINDENT# handler . setFormatter ( formatter ) #NEWLINE# return handler