#NEWLINE# def format( self , record ) : #NEWLINE# #INDENT# 'Uses contextstring if request_id is set, otherwise default.' #NEWLINE# if ( not isinstance ( record . msg , six . text_type ) ) : #NEWLINE# #INDENT# record . msg = six . text_type ( record . msg ) #NEWLINE# #UNINDENT# record . project = self . project #NEWLINE# record . version = self . version #NEWLINE# context = getattr ( local . store , 'context' , None ) #NEWLINE# if context : #NEWLINE# #INDENT# d = _dictify_context ( context ) #NEWLINE# for ( k , v ) in d . items ( ) : #NEWLINE# #INDENT# setattr ( record , k , v ) #NEWLINE# #UNINDENT# #UNINDENT# for key in ( 'instance' , 'color' , 'user_identity' ) : #NEWLINE# #INDENT# if ( key not in record . __dict__ ) : #NEWLINE# #INDENT# record . __dict__ [ key ] = '' #NEWLINE# #UNINDENT# #UNINDENT# if record . __dict__ . get ( 'request_id' ) : #NEWLINE# #INDENT# fmt = CONF . logging_context_format_string #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fmt = CONF . logging_default_format_string #NEWLINE# #UNINDENT# if ( ( record . levelno == logging . DEBUG ) and CONF . logging_debug_format_suffix ) : #NEWLINE# #INDENT# fmt += ( ' ' + CONF . logging_debug_format_suffix ) #NEWLINE# #UNINDENT# if ( sys . version_info < ( 3 , 2 ) ) : #NEWLINE# #INDENT# self . _fmt = fmt #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _style = logging . PercentStyle ( fmt ) #NEWLINE# self . _fmt = self . _style . _fmt #NEWLINE# #UNINDENT# if record . exc_info : #NEWLINE# #INDENT# record . exc_text = self . formatException ( record . exc_info , record ) #NEWLINE# #UNINDENT# return logging . Formatter . format ( self , record )