Home / Function/ logger() — flask Function Reference

logger() — flask Function Reference

Architecture documentation for the logger() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  01bfe763_91d4_5986_a6e1_da306981acee["logger()"]
  38f6d4a2_834e_2acd_e1b6_f45c58079ccd["App"]
  01bfe763_91d4_5986_a6e1_da306981acee -->|defined in| 38f6d4a2_834e_2acd_e1b6_f45c58079ccd
  style 01bfe763_91d4_5986_a6e1_da306981acee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/sansio/app.py lines 440–464

    def logger(self) -> logging.Logger:
        """A standard Python :class:`~logging.Logger` for the app, with
        the same name as :attr:`name`.

        In debug mode, the logger's :attr:`~logging.Logger.level` will
        be set to :data:`~logging.DEBUG`.

        If there are no handlers configured, a default handler will be
        added. See :doc:`/logging` for more information.

        .. versionchanged:: 1.1.0
            The logger takes the same name as :attr:`name` rather than
            hard-coding ``"flask.app"``.

        .. versionchanged:: 1.0.0
            Behavior was simplified. The logger is always named
            ``"flask.app"``. The level is only set during configuration,
            it doesn't check ``app.debug`` each time. Only one format is
            used, not different ones depending on ``app.debug``. No
            handlers are removed, and a handler is only added if no
            handlers are already configured.

        .. versionadded:: 0.3
        """
        return create_logger(self)

Subdomains

Frequently Asked Questions

What does logger() do?
logger() is a function in the flask codebase, defined in src/flask/sansio/app.py.
Where is logger() defined?
logger() is defined in src/flask/sansio/app.py at line 440.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free