def init_logging(logger, log_file, log_level):
with open(log_file, '<STR_LIT:w>'):<EOL><INDENT>pass<EOL><DEDENT>numeric_level = getattr(logging, log_level.upper(), None) if log_level else logging.INFO<EOL>if not isinstance(numeric_level, int):<EOL><INDENT>raise ValueError('<STR_LIT>' % log_level)<EOL><DEDENT>logger.setLevel(logging.DEBUG)<EOL>fh = logging.FileHandler(log_file)<EOL>fh.setLevel(logging.DEBUG)<EOL>ch = logging.StreamHandler()<EOL>ch.setLevel(numeric_level)<EOL>formatter = logging.Formatter('<STR_LIT>')<EOL>fh.setFormatter(formatter)<EOL>ch.setFormatter(formatter)<EOL>logger.addHandler(fh)<EOL>logger.addHandler(ch)<EOL>return CONSTANTS.OK<EOL>
Initialize the naarad logger.
:param: logger: logger object to initialize
:param: log_file: log file name
:param: log_level: log level (debug, info, warn, error)