flask 日志系统

python yekong

使用debug需要先开启debug

from flask import Flask
from api import route_api

app = Flask(__name__)
app.register_blueprint(route_api, url_prefix="/api")


@app.route('/')
def index():
    msg = "hello"
    app.logger.error(msg)
    app.logger.debug(msg)
    app.logger.info(msg)
    return "index"
if __name__ == "__main__":
    app.run(debug=True)

访问结果
wanjunshijiecom 2021-08-21 at 20.15.07

喜欢