diff options
author | Frederick Muriuki Muriithi | 2025-01-07 11:44:23 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-01-07 11:45:04 -0600 |
commit | 174e058d808f84207ce62582a275d8a3599fb050 (patch) | |
tree | 6849455cb0d68980a57a0757c2e1e54ba586ed2a /gn_libs/debug.py | |
parent | d36a1b4bda99c3bebc4f9a0a0ddadec904dbd398 (diff) | |
download | gn-libs-174e058d808f84207ce62582a275d8a3599fb050.tar.gz |
Add debugging utilities module.
Diffstat (limited to 'gn_libs/debug.py')
-rw-r--r-- | gn_libs/debug.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gn_libs/debug.py b/gn_libs/debug.py new file mode 100644 index 0000000..6b7173b --- /dev/null +++ b/gn_libs/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 |