Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filterx/expr-compound: include the type of the referenced object in trace #514

Merged
merged 1 commit into from
Feb 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/filterx/expr-compound.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ _eval_expr(FilterXExpr *expr, FilterXObject **result)
{
ScratchBuffersMarker mark;
GString *buf = scratch_buffers_alloc_and_mark(&mark);
GString *type_buffer = scratch_buffers_alloc();

if (res->type == &FILTERX_TYPE_NAME(ref))
{
FilterXRef *ref = (FilterXRef *) res;
g_string_append(type_buffer, "ref/");
g_string_append(type_buffer, ref->value->type->name);
}
else
g_string_append(type_buffer, res->type->name);

if (!filterx_object_repr(res, buf))
{
Expand All @@ -67,13 +77,13 @@ _eval_expr(FilterXExpr *expr, FilterXObject **result)
msg_debug("FILTERX FALSY",
filterx_expr_format_location_tag(expr),
evt_tag_mem("value", buf->str, buf->len),
evt_tag_str("type", res->type->name));
evt_tag_str("type", type_buffer->str));
else
msg_trace("FILTERX ESTEP",
filterx_expr_format_location_tag(expr),
evt_tag_mem("value", buf->str, buf->len),
evt_tag_int("truthy", filterx_object_truthy(res)),
evt_tag_str("type", res->type->name));
evt_tag_str("type", type_buffer->str));
scratch_buffers_reclaim_marked(mark);
}
return success;
Expand Down