#NEWLINE# def do_bugout( self , args ) : #NEWLINE# #INDENT# 'bugout [ <logger> ]  - remove a console logging handler from a logger' #NEWLINE# args = args . split ( ) #NEWLINE# if _debug : #NEWLINE# #INDENT# ConsoleCmd . _debug ( 'do_bugout %r' , args ) #NEWLINE# #UNINDENT# if args : #NEWLINE# #INDENT# loggerName = args [ 0 ] #NEWLINE# if ( loggerName in logging . Logger . manager . loggerDict ) : #NEWLINE# #INDENT# logger = logging . getLogger ( loggerName ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# loggerName = '__root__' #NEWLINE# logger = logging . getLogger ( ) #NEWLINE# #UNINDENT# if ( not logger ) : #NEWLINE# #INDENT# self . stdout . write ( 'not a valid logger name\n' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not ( loggerName in self . handlers ) ) : #NEWLINE# #INDENT# self . stdout . write ( ( 'no handler for %s\n' % loggerName ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# handler = self . handlers [ loggerName ] #NEWLINE# del self . handlers [ loggerName ] #NEWLINE# if hasattr ( logger , 'globs' ) : #NEWLINE# #INDENT# logger . globs [ '_debug' ] -= 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( logger . parent , 'globs' ) : #NEWLINE# #INDENT# logger . parent . globs [ '_debug' ] -= 1 #NEWLINE# #UNINDENT# #UNINDENT# logger . removeHandler ( handler ) #NEWLINE# self . stdout . write ( ( 'handler to %s removed\n' % loggerName ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . stdout . write ( '\n' )