]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
treewide: avoid using the deprecated verbose()
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 27 Jul 2021 08:29:22 +0000 (10:29 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 29 Jul 2021 09:43:40 +0000 (11:43 +0200)
It's mainly in tests.

37 files changed:
.luacheckrc
ci/respdiff/kresd.config
daemon/cache.test/clear.test.lua
daemon/cache.test/insert_ns.test.integr/kresd_config.j2
daemon/engine.c
daemon/main.c
doc/config-logging-monitoring.rst
doc/config-overview.rst
doc/kresd.8.in
etc/config/config.docker
lib/cache/overflow.test.integr/kresd_config.j2
lib/cache/test.integr/kresd_config.j2
lib/layer/test.integr/kresd_config.j2
lib/layer/validate.test.integr/kresd_config.j2
lib/rplan.h
modules/bogus_log/test.integr/kresd_config.j2
modules/daf/test.integr/kresd_config.j2
modules/http/README.rst
modules/http/trace.rst
modules/policy/README.rst
modules/policy/noipv6.test.integr/kresd_config.j2
modules/policy/noipvx.test.integr/kresd_config.j2
modules/policy/policy.lua
modules/policy/test.integr/kresd_config.j2
modules/prefill/prefill.test/prefill.test.lua
modules/rebinding/test.integr/kresd_config.j2
modules/refuse_nord/test.integr/kresd_config.j2
modules/renumber/renumber.test.lua
modules/serve_stale/test.integr/kresd_config.j2
modules/stats/test.integr/kresd_config.j2
modules/ta_update/ta_update.test.integr/kresd_config.j2
modules/ta_update/ta_update.unmanagedkey.test.integr/kresd_config.j2
modules/view/addr.test.integr/kresd_config.j2
modules/view/tsig.test.integr/kresd_config.j2
modules/watchdog/watchdog.lua
scripts/kresd-host.lua
tests/pytests/templates/kresd.conf.j2

index 6248c009470c93a7578d1e0fea69c8299d2ded95..0134706e8d7f7888861d6da3379e4e762597a5bb 100644 (file)
@@ -18,7 +18,6 @@ new_read_globals = {
        'todname',
        'tojson',
        'user',
-       'verbose',
        'worker',
        'kluautil_list_dir',
        -- Sandbox declarations
index be5c4582ef5368762a19251cbc544d844298fba1..0539cec71d509115f52bf74b7fd5cf7333d9fea9 100644 (file)
@@ -23,4 +23,4 @@ modules = {
 local _, up_bs = net.bufsize()
 net.bufsize(4096, up_bs)
 
-verbose(true)
+set_log_level('debug')
index 8185ae524ed7902c562e85446f32ed908c5443bd..c2da41cf0959220852e8e8d328f3479b80cdda84 100644 (file)
@@ -15,7 +15,7 @@ end
 policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 
 cache.size = 2*MB
--- verbose(true)
+-- set_log_level('debug')
 
 -- Self-checks on globals
 assert(help() ~= nil)
index 6da4f4fcb527c7bd715125993a674ecdbc93a3b7..11e13c9c4f0f1725e45cdf7bb27b4d44ccc3c6ba 100644 (file)
@@ -48,7 +48,7 @@ if detect_time_skew then
 end
 
 _hint_root_file('hints')
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 4d8cad7c5a836028009fe847b621fa803b581a1a..889d886f0b4829956a888c64619b9c65780ce81e 100644 (file)
@@ -74,7 +74,6 @@ static int l_help(lua_State *L)
                "hostname()\n    hostname\n"
                "package_version()\n    return package version\n"
                "user(name[, group])\n    change process user (and group)\n"
-               "verbose(true|false)\n    toggle verbose mode\n"
                "set_log_level\n        logging level (crit, err, warning, notice, info or debug)\n"
                "option(opt[, new_val])\n    get/set server option\n"
                "mode(strict|normal|permissive)\n    set resolver strictness level\n"
index dd14692d970d2c16e08a2247d01ad745a7ae861e..7e1112d2bda4405cf18f1180777a3e0ad2ee5d54 100644 (file)
@@ -130,7 +130,7 @@ static void help(int argc, char *argv[])
               " -c, --config=[path]    Config file path (relative to [rundir]) (default: config).\n"
               " -n, --noninteractive   Don't start the read-eval-print loop for stdin+stdout.\n"
               " -q, --quiet            No command prompt in interactive mode.\n"
-              " -v, --verbose          Run in verbose mode.\n"
+              " -v, --verbose          Increase logging to debug level.\n"
               " -V, --version        Print version of the server.\n"
               " -h, --help           Print help and usage.\n"
               "Options:\n"
index afddb8bee13169f29c21fc238471a922f8e4f184..6250a4fe3c3f0fe6335481cc75fd4aea791f65da 100644 (file)
@@ -14,8 +14,7 @@ in ``syslog.h``. It is possible change logging level using
 
 Logging level ``notice`` is set after start by default,
 so logs from Knot Resolver should contain only couple lines a day.
-For debugging purposes it is possible to enable very verbose logging using
-:func:`verbose` function.
+For debugging purposes it is possible to use the very verbose ``debug`` level.
 
 In addition to levels, logging is also divided into the
 :ref:`groups <config_log_groups>`. All groups
@@ -33,6 +32,9 @@ set by :func:`set_log_level`.
 
   .. py:function:: verbose([true | false])
 
+     .. deprecated:: 5.4.0
+        Use :func:`set_log_level` instead.
+
      :param: ``true`` enable ``debug`` level, ``false`` switch to default level (``notice``).
      :return: boolean ``true`` when ``debug`` level is enabled.
 
index 8613f9e4e2e3d00cb298ebe22e016bb6618fe25a..3d0f3c69f217089b6dae910205d93d9433191399 100644 (file)
@@ -62,18 +62,31 @@ The **interactive prompt** is denoted by ``>``, so all examples starting with ``
         > -- this is a comment entered into interactive prompt
         > -- comments have no effect here
         > -- the next line shows a command entered interactivelly and its output
-        > verbose()
-        false
-        > -- the previous line without > character is output from verbose() command
+        > get_log_level()
+        'notice'
+        > -- the previous line without > character is output from get_log_level() command
 
 Following example demontrates how to interactivelly list all currently loaded modules, and includes multi-line output:
 
 .. code-block:: lua
 
         > modules.list()
-        [1] => iterate
-        [2] => validate
-        [3] => cache
+        {
+            'iterate',
+            'validate',
+            'cache',
+            'ta_update',
+            'ta_signal_query',
+            'policy',
+            'priming',
+            'detect_time_skew',
+            'detect_time_jump',
+            'ta_sentinel',
+            'edns_keepalive',
+            'refuse_nord',
+            'watchdog',
+        }
+
 
 Before we dive into configuring features, let us explain modularization basics.
 
index 71eb3013026f7102214356412b2f994b22355ad9..e2e44715bdb56c9f158fc1b390a8c48abe0a3e3c 100644 (file)
@@ -108,8 +108,7 @@ Daemon will refrain from entering into read-eval-print loop for stdin+stdout.
 Daemon will refrain from printing the command prompt.
 .TP
 .B \-v\fR, \fB\-\-verbose
-Increase verbosity. If given multiple times, more information is logged.
-This is in addition to the verbosity (if any) from the config file.
+Increase logging to debug level.
 .TP
 .B \-h
 Show short commandline option help.
index 4805ae32bacdf7df8c5e3ae2c5289fe428f5ed37..bfededb5ebfa7a84cae06a8fd3c4a55185b1b4ca 100644 (file)
@@ -36,7 +36,7 @@ function interactive_mode()
                   .. '8453 -> web interface\n'
                   .. '\n'
                   .. 'For verbose logging enter following command to prompt below:\n'
-                  .. 'verbose(true)\n')
+                  .. 'set_log_level("debug")\n')
        end
        print_help()
 end
@@ -62,7 +62,7 @@ function debug_mode(qname, qtype)
        -- execute query right after start up and exit when the query is finished
        event.after(0, function()
                -- ultra verbose log
-               verbose(true)
+               set_log_level('debug')
                policy.add(policy.all(policy.DEBUG_ALWAYS))
                log_debug(ffi.C.LOG_GRP_RESOLVER, 'starting DNS query for %s %s', qname, kres.tostring.type[qtype])
                local starttime = cqueues.monotime()
index 87dbd69a2fcaf66666d1636cf355fca6ff279599..6279bb56373c16fab59deeac5282fb6eab08856c 100644 (file)
@@ -29,7 +29,7 @@ if detect_time_skew then
         modules.unload('detect_time_skew')
 end
 
-verbose(true)
+set_log_level('debug')
 policy.add(policy.all(policy.DEBUG_ALWAYS))
 
 cache.open(1*MB)
index 7c3724bd26abcbcdc7cc1a60797a5f945f646927..b1ae409e86b5ac160cfd2fc43580be14fac2774f 100644 (file)
@@ -26,7 +26,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 policy.add(policy.all(policy.DEBUG_ALWAYS))
 {% endraw %}
 
index 57c8542ed9080d4f586c6a68926939cb64d005b2..3bcd645b80e0e9939909a2447bd6b5c6dc2723fe 100644 (file)
@@ -63,7 +63,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 policy.add(policy.all(policy.DEBUG_ALWAYS))
 {% endraw %}
 
index ba6767f5060158f44fb900066e7ccf8d039f5a3d..47aaee1df03e138e7afcfd6ad85c98a031447871 100644 (file)
@@ -27,7 +27,7 @@ if detect_time_skew then
 end
 
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 policy.add(policy.all(policy.DEBUG_ALWAYS))
 policy.add(policy.all(policy.FORWARD('8.8.8.8')))
 {% endraw %}
index a0f8f55226a8e025ba27ae72eb0ddacc1a5ff8ed..5120521d7c83854b557a232fddc4b4e9285510ca 100644 (file)
@@ -41,7 +41,7 @@ struct kr_qflags {
        bool BADCOOKIE_AGAIN : 1;/**< Query again because bad cookie returned. */
        bool CNAME : 1;          /**< Query response contains CNAME in answer section. */
        bool REORDER_RR : 1;     /**< Reorder cached RRs. */
-       bool TRACE : 1;          /**< Also log answers if --verbose. */
+       bool TRACE : 1;          /**< Also log answers on debug level. */
        bool NO_0X20 : 1;        /**< Disable query case randomization . */
        bool DNSSEC_NODS : 1;    /**< DS non-existance is proven */
        bool DNSSEC_OPTOUT : 1;  /**< Closest encloser proof has optout */
index 27c082bfc1ec43b2ff2ad75a24c85bd7576eae4f..2b299dababab85a9ca39a0b2161466adba76c7bb 100644 (file)
@@ -59,7 +59,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index c8f838d54cf320aa46e00f93b5c1e4e0d38ecad4..60fc082099eb7585f3a4064fd4771c1a78949115 100644 (file)
@@ -34,7 +34,7 @@ policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 9cfad1f91a170baa9908c02c98394571bf636588..f7b52421dfcbcd424ab2d28d403cac29185f1cdc 100644 (file)
@@ -151,7 +151,7 @@ The HTTP module has several built-in services to use.
 
  "``/stats``", "Statistics/metrics", "Exported :ref:`metrics <mod-stats-list>` from :ref:`mod-stats` in JSON format."
  "``/metrics``", "Prometheus metrics", "Exported metrics for Prometheus_."
- "``/trace/:name/:type``", "Tracking", ":ref:`Trace resolution <mod-http-trace>` of a DNS query and return the verbose logs."
+ "``/trace/:name/:type``", "Tracking", ":ref:`Trace resolution <mod-http-trace>` of a DNS query and return its debug-level logs."
  "``/doh``", "Legacy DNS-over-HTTPS", ":rfc:`8484` endpoint, see :ref:`mod-http-doh`."
  "``/dns-query``", "Legacy DNS-over-HTTPS", ":rfc:`8484` endpoint, see :ref:`mod-http-doh`."
 
index 4fb60a3e0e1173ed53ccd0ae7af3c56bf77e7545..a766bc634e49a236e0d899fbbb8c64dcd0a8358d 100644 (file)
@@ -9,7 +9,7 @@ Using query policies
 --------------------
 
 Query policies :any:`policy.DEBUG_ALWAYS`, :any:`policy.DEBUG_CACHE_MISS` or
-:any:`policy.DEBUG_IF` can be used to enable verbose logging for selected
+:any:`policy.DEBUG_IF` can be used to enable debug-level logging for selected
 subdomains or queries matching specific conditions. Please refer to their
 documentation for usage.
 
@@ -18,7 +18,7 @@ Using HTTP module
 
 The :ref:`http module <mod-http>` provides ``/trace`` endpoint which allows to trace various
 aspects of the request execution. The basic mode allows you to resolve a query
-and trace verbose logs for it (and messages received):
+and trace debug-level logs for it (and messages received):
 
 .. code-block:: bash
 
index fce69e5e8b7aba1a6059c9a61d5abee71359973a..b981f3bbb93fac86107afe8d62c2a7a1fe8cbdb5 100644 (file)
@@ -203,7 +203,8 @@ Following actions act on request and then processing continue until first non-ch
 
 .. py:attribute:: QTRACE
 
-   Pretty-print DNS response packets from authoritative servers into the verbose log for the query and its sub-queries.  It's useful for debugging weird DNS servers. Verbose logging must be enabled using :func:`verbose` for this policy to be effective.
+   Pretty-print DNS response packets from authoritative servers into debug logs for the query and its sub-queries.  It's useful for debugging weird DNS servers.
+   Note that debug-level logs are off by default; see :func:`set_log_level`.
 
    .. code-block:: lua
 
@@ -213,8 +214,8 @@ Following actions act on request and then processing continue until first non-ch
 
 .. py:attribute:: REQTRACE
 
-   Pretty-print DNS requests from clients into the log.
-   It's useful for debugging weird DNS clients.
+   Pretty-print DNS requests from clients into the verbose log. It's useful for debugging weird DNS clients.
+   Debug-level logging must be enabled for this policy to be effective; see :func:`set_log_level`.
    It makes most sense together with :ref:`mod-view` (enabling per-client)
    and probably with verbose logging those request (e.g. ``DEBUG_ALWAYS``).
 
@@ -234,15 +235,15 @@ Following actions act on request and then processing continue until first non-ch
 
 .. py:function:: DEBUG_IF(test_function)
 
-   :param test_function: Function with single argument of type :c:type:`kr_request` which returns ``true`` if verbose logs for a given request should be printed and ``false`` otherwise.
+   :param test_function: Function with single argument of type :c:type:`kr_request` which returns ``true`` if debug logs for a given request should be generated and ``false`` otherwise.
 
    Enable extra verbose logging but print logs only for requests which match condition specified by ``test_function``. This allows to fine-tune which requests should be printed.
 
-   .. warning:: Verbose logging has significant performance impact on resolver and might also overload you logging system because one request can easily generate tens of kilobytes of logs. Always use appropriate `Filters`_ to limit number of requests triggering this action to a minimum!
+   .. warning:: Logging on debug level has significant performance impact on resolver and might also overload you logging system because one request can easily generate tens of kilobytes of logs. Always use appropriate `Filters`_ to limit number of requests triggering this action to a minimum!
 
-   .. note:: ``test_function`` is evaluated only when request is finished. As a result verbose logs for all requests must be collected until request is finished because it is not possible to know beforehand how ``test_function`` at the end evaluates given request. When a request is finalized logs are either printed or thrown away.
+   .. note:: ``test_function`` is evaluated only when request is finished. As a result debug logs for all requests must be collected until request is finished because it is not possible to know beforehand how ``test_function`` at the end evaluates given request. When a request is finalized logs are either printed or thrown away.
 
-   Example usage which gathers verbose logs for all requests in subtree ``dnssec-failed.org.`` and prints verbose logs for all requests finished with states different than ``kres.DONE`` (most importantly ``kres.FAIL``, see :c:type:`kr_layer_state`).
+   Example usage which gathers verbose logs for all requests in subtree ``dnssec-failed.org.`` and prints debug logs for all requests finished with states different than ``kres.DONE`` (most importantly ``kres.FAIL``, see :c:type:`kr_layer_state`).
 
    .. code-block:: lua
 
index 8e8c2636e09c02ec11cbdcab7718ad7e91f7ac48..31e28d7fd5892b5891cef74fd53a390e74df9e17 100644 (file)
@@ -28,7 +28,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 771927bcadc4f6be29b06043371a60abe6d52534..027331ffb91c343cde7bd907a5e45ce989a1d9c5 100644 (file)
@@ -29,7 +29,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index fbcfeadb060e72443b17c0181fa059d00b35ac5f..b943dd408b5b57f01a4177a3419a7757dcc54dba 100644 (file)
@@ -685,7 +685,7 @@ local debug_stashlog_cb = ffi.cast('trace_log_f', function (req, msg)
 end)
 ffi.gc(debug_stashlog_cb, free_cb)
 
--- buffer verbose logs and print then only if test() returns a truthy value
+-- buffer debug logs and print then only if test() returns a truthy value
 function policy.DEBUG_IF(test)
        local debug_finish_cb = ffi.cast('trace_callback_f', function (cbreq)
                jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
index 25cf0ee82dcbb74227f4307ca6eea93103530729..180d6186d51b9e4fb6e31fda58ae913e3de96eca 100644 (file)
@@ -27,7 +27,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 64c41ca8808c240bd1b8ca53df6c1f9b16f2f879..05dcb2cf013bb9458f6fa2b8b7fc37ea2f42e43f 100644 (file)
@@ -14,7 +14,7 @@ end
 policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 
 cache.size = 2*MB
--- verbose(true)
+-- set_log_level('debug')
 
 -- Self-checks on globals
 assert(help() ~= nil)
index 2f268935f87b997ef078cd424b2e623430ffad5d..cc52bc929cc04922d82d465561619de9daf1de5c 100644 (file)
@@ -27,7 +27,7 @@ modules.load('rebinding < iterate')
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 net.ipv6 = false
 {% endraw %}
 
index 3ecdf7d0478ad61ec70d0a2f38b054cb356d517d..b7d9ea1b78dfb676366d527f998f8c25c7575c22 100644 (file)
@@ -25,7 +25,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index c62bd77d16cffc89239ba21e90d38c1568f06a61..6703a9d9da9a118012a35289dd108200fdafc40b 100644 (file)
@@ -73,7 +73,7 @@ policy.add(policy.all(policy.DEBUG_ALWAYS))
 policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 prepare_cache()
 
-verbose(true)
+set_log_level('debug')
 modules.load('renumber < cache')
 renumber.config({
        -- Source subnet, destination subnet
index 5e3f55d7219ce87e5ba79342bf6ab5107808aea3..d619189664a2205544e120956d592f0067156313 100644 (file)
@@ -27,7 +27,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 {% if DO_IP6 == "true" %}
index f16993fa3234c92865a1beb54990280e612eb0d3..12fc26519d4097eab6ca409078e3a83fa92ece8d 100644 (file)
@@ -83,7 +83,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 60ad6131c53178e6192eb0f23560ec76a7ad2aae..74f5586c14529ae4cee6069fd8816649ddb1221b 100644 (file)
@@ -22,7 +22,7 @@ end
 
 policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 modules.load('hints')
index 7ba468fee9b38485d15ef4e8a0543fe6b5a76e4a..378a167956f15dc6fd88e834ce9a146061d583a6 100644 (file)
@@ -38,7 +38,7 @@ end
 
 policy.add(policy.suffix(policy.PASS, {todname('test.')}))
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 modules.load('hints')
index 14edc1a96cea838ecf51be8a37274df4fec49fce..2d85b742e63555c9c115bf8b9cac4bd8cd430a85 100644 (file)
@@ -31,7 +31,7 @@ end
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 6e2aa1962f368e9adadb708977aafc128f672ed5..042da2a864c157e4b7d99323013610b42e8bd9a7 100644 (file)
@@ -33,7 +33,7 @@ trust_anchors.remove('.')
 
 _hint_root_file('hints')
 cache.size = 2*MB
-verbose(true)
+set_log_level('debug')
 {% endraw %}
 
 net = { '{{SELF_ADDR}}' }
index 6c361711af67880b2d103313675cb253557a7583..00b6f7869556d284b89d7e9249c1222a94de7a95 100644 (file)
@@ -38,7 +38,7 @@ local function check_answer(logbuf)
                        private.ok_callback()
                        return
                end
-               log_info(ffi.C.LOG_GRP_WATCHDOG, 'watchdog query returned unexpected answer! query verbose log:')
+               log_info(ffi.C.LOG_GRP_WATCHDOG, 'watchdog query returned unexpected answer! query log:')
                log_info(ffi.C.LOG_GRP_WATCHDOG, table.concat(logbuf, ''))
                if pkt ~= nil then
                        log_info(ffi.C.LOG_GRP_WATCHDOG, 'problematic answer:\n%s', pkt)
index 6395a88e0c266decc821ecf6ede04b00976ba136..1adaef716647e52c05b165a74a46b533d75bb031 100755 (executable)
@@ -50,7 +50,7 @@ k = 1 while k <= #arg do
                verbose = true
        elseif v == '-d' then
                verbose = true
-               table.insert(config, 'verbose(true)')
+               table.insert(config, 'set_log_level("debug")')
        elseif v == '-4' then
                table.insert(config, 'net.ipv6 = false')
        elseif v == '-6' then
index 08c73c88a75d73fad2f19feb0583053caa76cedb..aa9135e46c4270894fc5342bfdcf202b9e2ba68f 100644 (file)
@@ -4,7 +4,9 @@ modules = {
     'policy > iterate',
 }
 
-verbose({{ 'true' if kresd.verbose else 'false' }})
+{% if kresd.verbose %}
+set_log_level('debug')
+{% endif %}
 
 {% if kresd.ip %}
 net.listen('{{ kresd.ip }}', {{ kresd.port }})