import logging
def getMyLogger():
logger = logging.getLogger('aaasgdssdfgaefag')
if not logger.handlers:
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('/Users/fangyuanyuan/Downloads/check_insert_enum.log')
fh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s')
fh.setFormatter(formatter)
logger.addHandler(fh)
return logger
if __name__ == '__main__':
logger = getMyLogger()
logger.debug('debug message=-----111')
logger.info('info message=-----111')