Add some very basic docs for logging changes

This commit is contained in:
Col Crunch 2020-03-13 14:42:09 -04:00
parent 527d7ef671
commit 38aaf545c6
2 changed files with 18 additions and 0 deletions

View File

@ -9,4 +9,5 @@ This section describes how to extend **Alliance Auth** with custom apps and serv
integrating-services integrating-services
menu-hooks menu-hooks
url-hooks url-hooks
logging
``` ```

View File

@ -0,0 +1,17 @@
# Logging from Custom Apps
Alliance Auth provides a logger for use with custom apps to make everyone's life a little easier.
## Using the Extensions Logger
The extensions logger should not be directly used by custom apps as the error messages logged to it
will not be labeled with the correct name. In order to correctly use the extensions logger please follow
the code below.
```python
import logging
logger = logging.getLogger('extensions.' + __name__)
logger.name = __name__
```
This works by creating a child logger of the extension logger which propagates all log entries
to the parent (extensions) logger.