Merge branch 'common_logger' into 'master'

Extensions Logging

See merge request allianceauth/allianceauth!1180
This commit is contained in:
Ariel Rin
2020-04-02 02:59:55 +00:00
4 changed files with 51 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
menu-hooks
url-hooks
logging
```

View File

@@ -0,0 +1,15 @@
# 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
AllianceAuth provides a helper function to get the logger for the current module to reduce the amount of
code you need to write.
```python
from allianceauth.services.hooks import get_extension_logger
logger = get_extension_logger(__name__)
```
This works by creating a child logger of the extension logger which propagates all log entries
to the parent (extensions) logger.