use app.name as app.logger name

This commit is contained in:
David Lord 2019-07-01 14:56:18 -07:00
parent 465da9f610
commit df470aecb9
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
8 changed files with 40 additions and 25 deletions

View file

@ -382,7 +382,7 @@ The following configuration values are used internally by Flask:
.. versionchanged:: 1.0
``LOGGER_NAME`` and ``LOGGER_HANDLER_POLICY`` were removed. See
:ref:`logging` for information about configuration.
:doc:`/logging` for information about configuration.
Added :data:`ENV` to reflect the :envvar:`FLASK_ENV` environment
variable.

View file

@ -231,7 +231,7 @@ errors, use ``getattr`` to get access it for compatibility.
Logging
-------
See :ref:`logging` for information on how to log exceptions, such as by
See :doc:`/logging` for information on how to log exceptions, such as by
emailing them to admins.

View file

@ -1,12 +1,12 @@
.. _logging:
Logging
=======
Flask uses standard Python :mod:`logging`. All Flask-related messages are
logged under the ``'flask'`` logger namespace.
:meth:`Flask.logger <flask.Flask.logger>` returns the logger named
``'flask.app'``, and can be used to log messages for your application. ::
Flask uses standard Python :mod:`logging`. Messages about your Flask
application are logged with :meth:`app.logger <flask.Flask.logger>`,
which takes the same name as :attr:`app.name <flask.Flask.name>`. This
logger can also be used to log your own messages.
.. code-block:: python
@app.route('/login', methods=['POST'])
def login():