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.

Parameters

NameTypeDescription
appAppThe Flask application instance used to determine the logger name, debug status, and error stream.

Returns

TypeDescription
logging.LoggerThe configured logger instance associated with the application's import name.