<s> import logging <EOL> import os <EOL> import logging . handlers <EOL> import sys <EOL> def setup_logger ( logger_name , logfile = '<STR_LIT>' ) : <EOL> _logger = logging . getLogger ( logger_name ) <EOL> _logger . setLevel ( logging . INFO ) <EOL> logfile_name , logfile_xtnsion = os . path . splitext ( logfile ) <EOL> fname = logfile <EOL> h = logging . handlers . RotatingFileHandler ( <EOL> filename = fname , maxBytes = <NUM_LIT> , backupCount = <NUM_LIT:1> ) <EOL> f = logging . Formatter ( <EOL> '<STR_LIT>' ) <EOL> h . setFormatter ( f ) <EOL> _logger . addHandler ( h ) <EOL> def setup_logger_stdout ( logger_name ) : <EOL> _logger = logging . getLogger ( logger_name ) <EOL> _logger . setLevel ( logging . DEBUG ) <EOL> ch = logging . StreamHandler ( sys . stdout ) <EOL> ch . setLevel ( logging . DEBUG ) <EOL> formatter = logging . Formatter ( '<STR_LIT>' ) <EOL> ch . setFormatter ( formatter ) <EOL> _logger . addHandler ( ch ) </s>
