# -*- coding: utf_8 -*-

############################
#   Log
#   日志
############################

import os
import logging
from logging.handlers import RotatingFileHandler

logPath = os.getcwd() + os.path.sep + "logs"
if not os.path.exists(logPath):
    os.makedirs(logPath)

fh = RotatingFileHandler("logs/running.log", maxBytes=10 * 1024 * 1024, backupCount=100)
fh.setLevel(logging.DEBUG)

<<<<<<< HEAD
# log write in console
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)

# log formatter
formatter = logging.Formatter('[%(asctime)s][%(levelname)7s] [%(filename)15s%(funcName)15s%(lineno)06s] %(message)s')
=======
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)

formatter = logging.Formatter('[%(asctime)s][%(levelname)7s][in %(pathname)s -> %(funcName)s line:%(lineno)s] %(message)s')
>>>>>>> 735d39eb4d0c3134b62bf4fe1b7a2ca0ea8da1ca
fh.setFormatter(formatter)
ch.setFormatter(formatter)

logger = logging.root
logger.setLevel(logging.INFO)
logger.addHandler(fh)
logger.addHandler(ch)