For debugging purposes it is possible to enable very verbose logging using
:func:`verbose` function.
-.. function:: verbose([true | false])
+.. py:function:: verbose([true | false])
:param: ``true`` to enable, ``false`` to disable verbose logging.
:return: boolean Current state of verbose logging.
-- requests for example.net. and its subdomains
policy.add(policy.suffix(policy.QTRACE, policy.todnames({'example.net'})))
+.. py:attribute:: REQTRACE
+
+ Pretty-print DNS requests from clients into the verbose log. It's useful for debugging weird DNS clients. Verbose logging must be enabled using :func:`verbose` for this policy to be effective. It makes most sense together with :ref:`mod-view`.
+
.. py:attribute:: DEBUG_ALWAYS
Enable extra verbose logging for all requests, including cache hits. See caveats for :func:`policy.DEBUG_IF`.
tostring(req.answer))
end)
+-- log request packet
+function policy.REQTRACE(_, req)
+ ffi.C.kr_log_req(req, 0, 0, 'dbg', 'request packet:\n%s',
+ tostring(req.qsource.packet))
+end
+
function policy.DEBUG_ALWAYS(_, req)
policy.QTRACE(_, req)
req.trace_log = debug_logline_cb
req.trace_finish = debug_logfinish_cb
+ policy.REQTRACE(_, req)
return
end
req.trace_log:free()
req.trace_finish:free()
end)
+ policy.REQTRACE(state, req)
return
end
end