#NEWLINE# def setup_logger( ) : #NEWLINE# #INDENT# formatter = logging . Formatter ( '%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) #NEWLINE# handler = None #NEWLINE# if LOG_FILE : #NEWLINE# #INDENT# handler = logging . FileHandler ( LOG_FILE ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# handler = logging . StreamHandler ( sys . stdout ) #NEWLINE# #UNINDENT# logger . setLevel ( LOG_LEVEL ) #NEWLINE# handler . setLevel ( LOG_LEVEL ) #NEWLINE# handler . setFormatter ( handler ) #NEWLINE# logger . addHandler ( handler )