In Flask: How to access app Logger within Blueprint In Flask: How to access app Logger within Blueprint flask flask

In Flask: How to access app Logger within Blueprint


inside the blueprint add:

from flask import current_app

and when needed call:

current_app.logger.info('grolsh')


Btw, I use this pattern:

# core.pyfrom werkzeug.local import LocalProxyfrom flask import current_applogger = LocalProxy(lambda: current_app.logger)# views.pyfrom core import logger@mod.route("/")def index():    logger.info("serving index")    ...