13 lines
360 B
Python
13 lines
360 B
Python
import logging
|
|
from logging.handlers import TimedRotatingFileHandler
|
|
# 配置日志
|
|
handlers = [TimedRotatingFileHandler("log\\app.log",when="H",interval=1,backupCount=7),logging.StreamHandler()]
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(levelname)s - %(message)s',
|
|
handlers=handlers
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|