diff options
author | Frederick Muriuki Muriithi | 2024-11-04 16:30:52 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-11-04 16:31:27 -0600 |
commit | 5f03be90761126468a3aa1972740c439498cb331 (patch) | |
tree | db8cc18da9c6a8ae547b0be04e61230c1a237058 | |
parent | 3a276642bea934f0a7ef8f581d8639e617357a2a (diff) | |
download | gn-auth-5f03be90761126468a3aa1972740c439498cb331.tar.gz |
Add debug-logging module.
Useful for debugging in remote environments.
-rw-r--r-- | gn_auth/debug.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gn_auth/debug.py b/gn_auth/debug.py new file mode 100644 index 0000000..6b7173b --- /dev/null +++ b/gn_auth/debug.py @@ -0,0 +1,22 @@ +"""Debug utilities""" +import logging +from flask import current_app + +__this_module_name__ = __name__ + + +# pylint: disable=invalid-name +def getLogger(name: str): + """Return a logger""" + return ( + logging.getLogger(name) + if not bool(current_app) + else current_app.logger) + +def __pk__(*args): + """Format log entry""" + value = args[-1] + title_vals = " => ".join(args[0:-1]) + logger = getLogger(__this_module_name__) + logger.debug("%s: %s", title_vals, value) + return value |