Skip to content

Commit 10899f3

Browse files
committed
clean up debug output
print node names, which helps a lot in telling what the heck these things are. print "func" for functions, and not "xlat"
1 parent d8b788c commit 10899f3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/unlang/xlat_tokenize.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,10 @@ static size_t xlat_quote_table_len = NUM_ELEMENTS(xlat_quote_table);
962962
static void _xlat_debug_head(xlat_exp_head_t const *head, int depth);
963963
static void _xlat_debug_node(xlat_exp_t const *node, int depth)
964964
{
965-
INFO_INDENT("{");
965+
INFO_INDENT("{ -- %s", node->fmt);
966+
#ifndef NDEBUG
967+
// INFO_INDENT(" %s:%d", node->file, node->line);
968+
#endif
966969
depth++;
967970

968971
if (node->quote != T_BARE_WORD) INFO_INDENT("quote = %c", fr_token_quote[node->quote]);
@@ -1019,6 +1022,7 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth)
10191022
}
10201023
} else if (tmpl_is_data(node->vpt)) {
10211024
INFO_INDENT("tmpl (%s) type %s", node->fmt, fr_type_to_str(tmpl_value_type(node->vpt)));
1025+
10221026
} else if (tmpl_is_xlat(node->vpt)) {
10231027
INFO_INDENT("tmpl xlat (%s)", node->fmt);
10241028
_xlat_debug_head(tmpl_xlat(node->vpt), depth + 1);
@@ -1041,7 +1045,7 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth)
10411045

10421046
case XLAT_FUNC:
10431047
fr_assert(node->call.func != NULL);
1044-
INFO_INDENT("xlat (%s)", node->call.func->name);
1048+
INFO_INDENT("func (%s)", node->call.func->name);
10451049
if (xlat_exp_head(node->call.args)) {
10461050
INFO_INDENT("{");
10471051
_xlat_debug_head(node->call.args, depth + 1);
@@ -1050,7 +1054,7 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth)
10501054
break;
10511055

10521056
case XLAT_FUNC_UNRESOLVED:
1053-
INFO_INDENT("xlat-unresolved (%s)", node->fmt);
1057+
INFO_INDENT("func-unresolved (%s)", node->fmt);
10541058
if (xlat_exp_head(node->call.args)) {
10551059
INFO_INDENT("{");
10561060
_xlat_debug_head(node->call.args, depth + 1);

0 commit comments

Comments
 (0)