#NEWLINE# def log( self , message , * args , **kwargs ) : #NEWLINE# #INDENT# id = kwargs . pop ( 'id' , None ) #NEWLINE# duration = kwargs . pop ( 'duration' , None ) #NEWLINE# level = kwargs . pop ( 'level' , logging . INFO ) #NEWLINE# tpl_bits = [ ] #NEWLINE# if id : #NEWLINE# #INDENT# tpl_bits . append ( self . style . SQL_FIELD ( ( '[%s/%s]' % ( self . module . logger_name , id ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tpl_bits . append ( self . style . SQL_FIELD ( ( '[%s]' % self . module . logger_name ) ) ) #NEWLINE# #UNINDENT# if duration : #NEWLINE# #INDENT# tpl_bits . append ( self . style . SQL_KEYWORD ( ( '(%dms)' % duration ) ) ) #NEWLINE# #UNINDENT# if args : #NEWLINE# #INDENT# message = ( message % args ) #NEWLINE# #UNINDENT# message = smart_str ( message ) #NEWLINE# if ( level == logging . ERROR ) : #NEWLINE# #INDENT# message = self . style . ERROR ( message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( level == logging . WARN ) : #NEWLINE# #INDENT# message = self . style . NOTICE ( message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# HTTP_INFO = self . style . HTTP_INFO #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# HTTP_INFO = termcolors . make_style ( fg = 'red' ) #NEWLINE# #UNINDENT# message = HTTP_INFO ( message ) #NEWLINE# #UNINDENT# #UNINDENT# tpl = ( ' ' . join ( tpl_bits ) % dict ( id = id , module = self . module . logger_name , asctime = datetime . datetime . now ( ) . strftime ( '%Y-%m-%d %H:%M:%S' ) ) ) #NEWLINE# indent = ( ' ' * ( len ( strip_bash_colors ( tpl ) ) + 1 ) ) #NEWLINE# new_message = [ ] #NEWLINE# first = True #NEWLINE# for line in message . split ( '\n' ) : #NEWLINE# #INDENT# if first : #NEWLINE# #INDENT# new_message . append ( line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_message . append ( ( '%s%s' % ( indent , line ) ) ) #NEWLINE# #UNINDENT# first = False #NEWLINE# #UNINDENT# message = ( '%s %s' % ( tpl , '\n' . join ( new_message ) ) ) #NEWLINE# sys . stdout . write ( ( ( '    ' + message ) + '\n' ) )