Skip to content

Logging

Milan edited this page Feb 5, 2021 · 1 revision

The following page assumes knowledge of the Python programming language.

It's a good idea to log information you believe is important that can aid with debugging, particularly warnings and errors.

To do this, make sure to import the __globals__ module.

from src import __globals__

You'll also want to import the settings module.

from src import settings

To log a warning, add the following code:

if settings.do_logs:
    __globals__.logger.warn('This is a warning message')

You can also log errors, along with other logging levels.

Python logging

Clone this wiki locally