I\'m building a website using Flask and I\'m now in the process of adding some logging to it for which I found these docs. The basic example is as follows:
i
The Flask logger uses the "generic" Python logging, it's a logging.getLogger(name)
like any other.
The logger exists so that Flask app and views can log things that happen during execution. For example, it will log tracebacks on 500 errors during debug mode. The configuration example is there to show how to enable these logs, which are still useful in production, when you are not in debug mode.
Having an internal logger is not unique to Flask, it's the standard way to use logging in Python. Every module defines it's own logger, but the configuration of the logging is only handled by the last link in the chain: your project.
You can also use app.logger
for your own messages, although it's not required. You could also create a separate logger for your own messages. In the end, it's all Python logging.