mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 14:30:17 +02:00
Add some very basic docs for logging changes
This commit is contained in:
parent
527d7ef671
commit
38aaf545c6
@ -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
|
||||||
```
|
```
|
||||||
|
17
docs/development/custom/logging.md
Normal file
17
docs/development/custom/logging.md
Normal 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.
|
Loading…
x
Reference in New Issue
Block a user