]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
logging: debug logging level for individual components(processes) docs-logging-impr-dwwxha/deployments/7498
authorAleš Mrázek <ales.mrazek@nic.cz>
Tue, 26 Aug 2025 13:12:01 +0000 (15:12 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Thu, 28 Aug 2025 11:30:28 +0000 (13:30 +0200)
- datamodel: logging-groups: added LogGroupsProcessesEnum

doc/_static/config.schema.json
python/knot_resolver/datamodel/logging_schema.py
python/knot_resolver/datamodel/templates/logging.lua.j2
python/knot_resolver/datamodel/templates/policy-config.lua.j2
python/knot_resolver/utils/modeling/base_schema.py

index 88e11901d818a2a2a999cb15a8cf32294196da20..a2dd6421954e1d08cabd5bbe3cc64d22d7572900 100644 (file)
                         "enum": [
                             "manager",
                             "supervisord",
+                            "policy-loader",
+                            "kresd",
                             "cache-gc",
                             "system",
                             "cache",
index 6c398a8592d1960f6122090ac7ac30240bc28e7c..51d0a0e8494816c45193f89cc4f7243ee7ae6a54 100644 (file)
@@ -7,10 +7,16 @@ from knot_resolver.utils.modeling.base_schema import is_obj_type_valid
 
 LogLevelEnum = Literal["crit", "err", "warning", "notice", "info", "debug"]
 LogTargetEnum = Literal["syslog", "stderr", "stdout"]
-LogGroupsEnum = Literal[
+
+LogGroupsProcessesEnum = Literal[
     "manager",
     "supervisord",
+    "policy-loader",
+    "kresd",
     "cache-gc",
+]
+
+LogGroupsKresdEnum = Literal[
     ## Now the LOG_GRP_*_TAG defines, exactly from ../../../lib/log.h
     "system",
     "cache",
@@ -62,6 +68,8 @@ LogGroupsEnum = Literal[
     # "reqdbg",... (non-displayed section of the enum)
 ]
 
+LogGroupsEnum = Literal[LogGroupsProcessesEnum, LogGroupsKresdEnum]
+
 
 class DnstapSchema(ConfigSchema):
     """
index 2d5937a832b7fe158a6ecefac45ffc2db402db2a..4afe48c4712a5325e8e6ba319200b5a7ad3e0a2c 100644 (file)
@@ -1,7 +1,11 @@
 {% from 'macros/common_macros.lua.j2' import boolean %}
 
 -- logging.level
+{% if cfg.logging.groups and "kresd" in cfg.logging.groups %}
+log_level('debug')
+{% else %}
 log_level('{{ cfg.logging.level }}')
+{% endif %}
 
 {% if cfg.logging.target -%}
 -- logging.target
@@ -12,7 +16,7 @@ log_target('{{ cfg.logging.target }}')
 -- logging.groups
 log_groups({
 {% for g in cfg.logging.groups %}
-{% if g != "manager" and g != "supervisord" and g != "cache-gc" %}
+{% if g not in ["manager", "supervisord", "policy-loader", "kresd", "cache-gc"] %}
     '{{ g }}',
 {% endif %}
 {% endfor %}
index fbd824b38ec7012de19cc67b02566f0f57c13f86..ec30171d844ea6b831c2ab1c7732096cb2fa07ab 100644 (file)
@@ -5,7 +5,11 @@ ffi = require('ffi')
 local C = ffi.C
 
 -- logging.level
+{% if cfg.logging.groups and "policy-loader" in cfg.logging.groups %}
+log_level('debug')
+{% else %}
 log_level('{{ cfg.logging.level }}')
+{% endif %}
 
 {% if cfg.logging.target -%}
 -- logging.target
@@ -16,7 +20,7 @@ log_target('{{ cfg.logging.target }}')
 -- logging.groups
 log_groups({
 {% for g in cfg.logging.groups %}
-{% if g != "manager" and g != "supervisord" and g != "cache-gc" %}
+{% if g not in ["manager", "supervisord", "policy-loader", "kresd", "cache-gc"] %}
     '{{ g }}',
 {% endif %}
 {% endfor %}
index 73cd1d0aa6de20514da708b3cccf2658ab5a7cea..06b01d0113519f9045774e8dfa0ea0c61e785424 100644 (file)
@@ -195,7 +195,13 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]:  # noqa: PLR0911, PLR0912
         return {"type": "string"}
 
     if is_literal(typ):
-        lit = get_generic_type_arguments(typ)
+        lit: List[Any] = []
+        args = get_generic_type_arguments(typ)
+        for arg in args:
+            if is_literal(arg):
+                lit += get_generic_type_arguments(arg)
+            else:
+                lit.append(arg)
         return {"type": "string", "enum": lit}
 
     if is_optional(typ):