#NEWLINE# def log_exception( name , **kwargs ) : #NEWLINE# #INDENT# 'Logs an exception, along with relevant information such as message,\n    traceback, and anything provided pertinent to the situation. This function\n    does nothing unless called while an exception is being handled.\n\n    :param name: ``name`` as passed in to :py:func:`logging.getLogger()`.\n    :param kwargs: Other keywords may be passed in and will be included in the\n                   produced log line.\n\n    ' #NEWLINE# ( type , value , tb ) = sys . exc_info ( ) #NEWLINE# if ( not value ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# tb_repr = reprlib . Repr ( ) #NEWLINE# tb_repr . maxstring = 10000 #NEWLINE# logger = logging . getLogger ( name ) #NEWLINE# data = kwargs . copy ( ) #NEWLINE# data [ 'message' ] = str ( value ) #NEWLINE# data [ 'args' ] = value . args #NEWLINE# tb_str = traceback . format_exception ( type , value , tb ) #NEWLINE# data_str = ' ' . join ( [ '=' . join ( ( key , log_repr . repr ( val ) ) ) for ( key , val ) in sorted ( data . items ( ) ) ] ) #NEWLINE# logger . error ( 'exception:{0}:unhandled {1} traceback={2}' . format ( type . __name__ , data_str , tb_repr . repr ( tb_str ) ) )