With multiple and/or dynamically managed response handlers at play, it
becomes useful for debugging purposes to know which handler (if any) was
used for preparing each response sent by the server. Add debug logs
providing that information. Make class name the default string
representation of each response handler to prettify logs.
"""
yield DnsResponseSend(qctx.response)
+ def __str__(self) -> str:
+ return self.__class__.__name__
+
class IgnoreAllQueries(ResponseHandler):
"""
response_handled = True
if not response_handled:
+ logging.debug("Responding based on zone data")
yield qctx.response
def _prepare_response_from_zone_data(self, qctx: QueryContext) -> None:
"""
for handler in self._response_handlers:
if handler.match(qctx):
+ logging.debug("Matched response handler: %s", handler)
async for response in handler.get_responses(qctx):
yield response
return