def echo(message): """Listen for messages and echo them for logging""" try: js_msg = json.loads(message) if whitelist and js_msg.get("type") not in whitelist: return if blacklist and js_msg.get("type") in blacklist: return if js_msg.get("type") == "registration": # do not log tokens from registration messages js_msg["data"]["token"] = None message = json.dumps(js_msg) except Exception: pass LOG(name).debug(message)
def test_logging(): LOG.debug('testing debug') LOG.info('testing info') LOG.warning('testing warning') LOG.error('testing error') LOG('testing custom').debug('test')