#NEWLINE# def log( self , level , msg , * args , **kw ) : #NEWLINE# #INDENT# if args : #NEWLINE# #INDENT# if kw : #NEWLINE# #INDENT# raise TypeError ( 'You may give positional or keyword arguments, not both' ) #NEWLINE# #UNINDENT# #UNINDENT# args = ( args or kw ) #NEWLINE# rendered = None #NEWLINE# for ( consumer_level , consumer ) in self . consumers : #NEWLINE# #INDENT# if self . level_matches ( level , consumer_level ) : #NEWLINE# #INDENT# if ( self . in_progress_hanging and ( consumer in ( sys . stdout , sys . stderr ) ) ) : #NEWLINE# #INDENT# self . in_progress_hanging = False #NEWLINE# sys . stdout . write ( '\n' ) #NEWLINE# sys . stdout . flush ( ) #NEWLINE# #UNINDENT# if ( rendered is None ) : #NEWLINE# #INDENT# if args : #NEWLINE# #INDENT# rendered = ( msg % args ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rendered = msg #NEWLINE# #UNINDENT# rendered = ( ( ' ' * self . indent ) + rendered ) #NEWLINE# #UNINDENT# if hasattr ( consumer , 'write' ) : #NEWLINE# #INDENT# consumer . write ( ( rendered + '\n' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# consumer ( rendered )