#NEWLINE# def _init_logger( debug = False , log_format = None ) : #NEWLINE# #INDENT# 'Initialize the logger\n\n    :param debug: Whether to enable debug mode\n    :return: An instantiated logging instance\n    ' #NEWLINE# logger . handlers = [ ] #NEWLINE# log_level = logging . INFO #NEWLINE# if debug : #NEWLINE# #INDENT# log_level = logging . DEBUG #NEWLINE# #UNINDENT# if ( not log_format ) : #NEWLINE# #INDENT# log_format_string = constants . log_format_string #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log_format_string = log_format #NEWLINE# #UNINDENT# logging . captureWarnings ( True ) #NEWLINE# logger . setLevel ( log_format ) #NEWLINE# handler = logging . StreamHandler ( sys . stderr ) #NEWLINE# handler . setFormatter ( logging . Formatter ( log_format_string ) ) #NEWLINE# logger . addHandler ( handler ) #NEWLINE# logger . debug ( 'logging initialized' )