(self, eventDict)
日志处理
日志处理
日志处理
def __call__(self, eventDict):
        '''日志处理
        '''
        if 'logLevel' in eventDict:
            level = eventDict['logLevel']
        elif eventDict['isError']:
            level = 'ERROR'
        else:
            level = 'INFO'
        text = log.textFromEventDict(eventDict)
        if text is None or level != 'ERROR':
            return
        nowdate = datetime.datetime.now()
        self.file.write('['+str(nowdate)+']\n'+str(level)+ '\n\t' + text + '\r\n')
        self.file.flush()
def __call__ ( self , eventDict ) : if 'logLevel' in eventDict : level = eventDict [ 'logLevel' ] elif eventDict [ 'isError' ] : level = 'ERROR' else : level = 'INFO' text = log . textFromEventDict ( eventDict ) if text is None or level != 'ERROR' : return nowdate = datetime . datetime . now ( ) self . file . write ( '[' + str ( nowdate ) + ']\n' + str ( level ) + '\n\t' + text + '\r\n' ) self . file . flush ( )