aboutsummaryrefslogtreecommitdiff
path: root/gn3/debug.py
blob: 8b67a92ef2a46b42a6825725646e1069757efdd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Debug utilities"""
import logging
from flask import current_app

__this_module_name__ = __name__


# pylint: disable=invalid-name
def getLogger():
    """Return a logger"""
    return (
        logging.getLogger(__this_module_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()
    logger.debug("%s: %s", title_vals, value)
    return value