#NEWLINE# def setup_logging( path , level ) : #NEWLINE# #INDENT# 'Setup application logging.\n    ' #NEWLINE# log_handler = logging . handlers . RotatingFileHandler ( path , maxBytes = ( 1024 * 1024 ) , backupCount = 2 ) #NEWLINE# root_logger = logging . getLogger ( '' ) #NEWLINE# root_logger . setLevel ( ch ) #NEWLINE# format = '%(name)s - %(message)s' #NEWLINE# formatter = logging . Formatter ( format ) #NEWLINE# log_handler . setFormatter ( formatter ) #NEWLINE# root_logger . addHandler ( log_handler ) #NEWLINE# ch = logging . StreamHandler ( ) #NEWLINE# ch . setLevel ( logging . INFO ) #NEWLINE# formatter = logging . Formatter ( '--> %(message)s' ) #NEWLINE# ch . setFormatter ( formatter ) #NEWLINE# root_logger . addHandler ( ch )