#NEWLINE# def setup_logger( logger , fname , stream = True , mode = logging . ERROR ) : #NEWLINE# #INDENT# 'Setup a log file and the logger in `ETSConfig.application_home`.\n\n    Parameters:\n    -----------\n\n    fname -- file name the logger should use.\n\n    stream -- Add a stream handler.\n\n    mode -- the logging mode.\n\n    ' #NEWLINE# path = os . path . join ( ETSConfig . application_home , fname ) #NEWLINE# handler = LogFileHandler ( path ) #NEWLINE# logger . addHandler ( handler ) #NEWLINE# if stream : #NEWLINE# #INDENT# s = logging . StreamHandler ( ) #NEWLINE# s . setFormatter ( FORMATTER ) #NEWLINE# s . setLevel ( mode ) #NEWLINE# logger . addHandler ( s ) #NEWLINE# #UNINDENT# logger . info ( ( '*' * 80 ) ) #NEWLINE# logger . info ( "logfile is: '%s'" , os . path . abspath ( path ) ) #NEWLINE# logger . info ( ( '*' * 80 ) )