diff --git a/docs/development/custom/index.md b/docs/development/custom/index.md index d0f51068..72882345 100644 --- a/docs/development/custom/index.md +++ b/docs/development/custom/index.md @@ -9,4 +9,5 @@ This section describes how to extend **Alliance Auth** with custom apps and serv integrating-services menu-hooks url-hooks + logging ``` diff --git a/docs/development/custom/logging.md b/docs/development/custom/logging.md new file mode 100644 index 00000000..9727e339 --- /dev/null +++ b/docs/development/custom/logging.md @@ -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. \ No newline at end of file