Skip to content

Commit 07efb43

Browse files
committed
logging: debug logging level for individual components(processes)
- datamodel: logging-groups: added LogGroupsProcessesEnum
1 parent da52586 commit 07efb43

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

doc/_static/config.schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,8 @@
15241524
"enum": [
15251525
"manager",
15261526
"supervisord",
1527+
"policy-loader",
1528+
"kresd",
15271529
"cache-gc",
15281530
"system",
15291531
"cache",

python/knot_resolver/datamodel/logging_schema.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77

88
LogLevelEnum = Literal["crit", "err", "warning", "notice", "info", "debug"]
99
LogTargetEnum = Literal["syslog", "stderr", "stdout"]
10-
LogGroupsEnum = Literal[
10+
11+
LogGroupsProcessesEnum = Literal[
1112
"manager",
1213
"supervisord",
14+
"policy-loader",
15+
"kresd",
1316
"cache-gc",
17+
]
18+
19+
LogGroupsKresdEnum = Literal[
1420
## Now the LOG_GRP_*_TAG defines, exactly from ../../../lib/log.h
1521
"system",
1622
"cache",
@@ -62,6 +68,8 @@
6268
# "reqdbg",... (non-displayed section of the enum)
6369
]
6470

71+
LogGroupsEnum = Literal[LogGroupsProcessesEnum, LogGroupsKresdEnum]
72+
6573

6674
class DnstapSchema(ConfigSchema):
6775
"""

python/knot_resolver/datamodel/templates/logging.lua.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{% from 'macros/common_macros.lua.j2' import boolean %}
22

33
-- logging.level
4+
{% if cfg.logging.groups and "kresd" in cfg.logging.groups %}
5+
log_level('debug')
6+
{% else %}
47
log_level('{{ cfg.logging.level }}')
8+
{% endif %}
59

610
{% if cfg.logging.target -%}
711
-- logging.target
@@ -12,7 +16,7 @@ log_target('{{ cfg.logging.target }}')
1216
-- logging.groups
1317
log_groups({
1418
{% for g in cfg.logging.groups %}
15-
{% if g != "manager" and g != "supervisord" and g != "cache-gc" %}
19+
{% if g not in ["manager", "supervisord", "policy-loader", "kresd", "cache-gc"] %}
1620
'{{ g }}',
1721
{% endif %}
1822
{% endfor %}

python/knot_resolver/datamodel/templates/policy-loader.lua.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ ffi = require('ffi')
55
local C = ffi.C
66

77
-- logging.level
8+
{% if cfg.logging.groups and "policy-loader" in cfg.logging.groups %}
9+
log_level('debug')
10+
{% else %}
811
log_level('{{ cfg.logging.level }}')
12+
{% endif %}
913

1014
{% if cfg.logging.target -%}
1115
-- logging.target
@@ -16,7 +20,7 @@ log_target('{{ cfg.logging.target }}')
1620
-- logging.groups
1721
log_groups({
1822
{% for g in cfg.logging.groups %}
19-
{% if g != "manager" and g != "supervisord" and g != "cache-gc" %}
23+
{% if g not in ["manager", "supervisord", "policy-loader", "kresd", "cache-gc"] %}
2024
'{{ g }}',
2125
{% endif %}
2226
{% endfor %}

python/knot_resolver/utils/modeling/base_schema.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,13 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]: # noqa: PLR0911, PLR0912
197197
return {"type": "string"}
198198

199199
if is_literal(typ):
200-
lit = get_generic_type_arguments(typ)
200+
lit: List[Any] = []
201+
args = get_generic_type_arguments(typ)
202+
for arg in args:
203+
if is_literal(arg):
204+
lit += get_generic_type_arguments(arg)
205+
else:
206+
lit.append(arg)
201207
return {"type": "string", "enum": lit}
202208

203209
if is_optional(typ):

0 commit comments

Comments
 (0)