Skip to main content

create_logger

Get the Flask app's logger and configure it if needed. The logger name will be the same as :attr:app.import_name < flask.Flask.name >. When :attr:~flask.Flask.debug is enabled, set the logger level to :data:logging.DEBUG if it is not set. If there is no handler for the logger's effective level, add a :class:~logging.StreamHandler for :func:~flask.logging.wsgi_errors_stream with a basic format.

def create_logger(
app: App
) - > logging.Logger

Get the Flask app's logger and configure it if needed. The logger name will be the same as :attr:app.import_name < flask.Flask.name >. When :attr:~flask.Flask.debug is enabled, set the logger level to :data:logging.DEBUG if it is not set. If there is no handler for the logger's effective level, add a :class:~logging.StreamHandler for :func:~flask.logging.wsgi_errors_stream with a basic format.

Parameters

NameTypeDescription
appAppThe Flask application instance for which to create or configure the logger.

Returns

TypeDescription
logging.LoggerThe configured logger instance for the Flask application.