From 38aaf545c6a53fcff82a593584ccfeee1eb15a81 Mon Sep 17 00:00:00 2001 From: Col Crunch Date: Fri, 13 Mar 2020 14:42:09 -0400 Subject: [PATCH] Add some very basic docs for logging changes --- docs/development/custom/index.md | 1 + docs/development/custom/logging.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 docs/development/custom/logging.md 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