# -*- coding: utf-8 -*-
'''
在日志文件里记录日志
'''
import logging
import math

logger = logging.getLogger()
#set loghandler
file = logging.FileHandler("log_file.log")
logger.addHandler(file)
#set formater
#formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
file.setFormatter(formatter) 
#set log level
'''
logging提供多种级别的日志信息，如：NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL等。
'''
logger.setLevel(logging.NOTSET)


for i in range(0,10):
	logger.info(str(i))

bad051e9bec40839419459586ea33f30ee08a3df
<mask token>

<mask token>
logger.addHandler(file)
<mask token>
file.setFormatter(formatter)
<mask token>
logger.setLevel(logging.NOTSET)
for i in range(0, 10):
    logger.info(str(i))

<mask token>
logger = logging.getLogger()
file = logging.FileHandler('log_file.log')
logger.addHandler(file)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
file.setFormatter(formatter)
<mask token>
logger.setLevel(logging.NOTSET)
for i in range(0, 10):
    logger.info(str(i))

<mask token>
import logging
import math
logger = logging.getLogger()
file = logging.FileHandler('log_file.log')
logger.addHandler(file)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
file.setFormatter(formatter)
<mask token>
logger.setLevel(logging.NOTSET)
for i in range(0, 10):
    logger.info(str(i))

# -*- coding: utf-8 -*-
'''
在日志文件里记录日志
'''
import logging
import math

logger = logging.getLogger()
#set loghandler
file = logging.FileHandler("log_file.log")
logger.addHandler(file)
#set formater
#formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
file.setFormatter(formatter) 
#set log level
'''
logging提供多种级别的日志信息，如：NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL等。
'''
logger.setLevel(logging.NOTSET)


for i in range(0,10):
	logger.info(str(i))
