Commit 55e253fd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Roto-till the panic/backtrace output to use the VSB auto-indent.

Based largely on patch from:	Martin

I wonder if we should make the panic output (readable) JSON format ?
parent fb067772
......@@ -319,17 +319,17 @@ vbe_panic(const struct director *d, struct vsb *vsb)
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC);
VSB_printf(vsb, " display_name = %s\n", bp->display_name);
VSB_printf(vsb, "display_name = %s\n", bp->display_name);
if (bp->ipv4_addr != NULL)
VSB_printf(vsb, " ipv4 = %s\n", bp->ipv4_addr);
VSB_printf(vsb, "ipv4 = %s\n", bp->ipv4_addr);
if (bp->ipv6_addr != NULL)
VSB_printf(vsb, " ipv6 = %s\n", bp->ipv6_addr);
VSB_printf(vsb, " port = %s\n", bp->port);
VSB_printf(vsb, " hosthdr = %s\n", bp->hosthdr);
VSB_printf(vsb, " health=%s, admin_health=%s",
VSB_printf(vsb, "ipv6 = %s\n", bp->ipv6_addr);
VSB_printf(vsb, "port = %s\n", bp->port);
VSB_printf(vsb, "hosthdr = %s\n", bp->hosthdr);
VSB_printf(vsb, "health=%s, admin_health=%s",
bp->healthy ? "healthy" : "sick", bp->admin_health);
VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed);
VSB_printf(vsb, " n_conn = %u\n", bp->n_conn);
VSB_printf(vsb, "n_conn = %u\n", bp->n_conn);
}
/*--------------------------------------------------------------------*/
......
......@@ -187,10 +187,15 @@ VDI_Panic(const struct director *d, struct vsb *vsb, const char *nm)
{
if (d == NULL)
return;
VSB_printf(vsb, " %s = %p {\n", nm, d);
VSB_printf(vsb, " vcl_name = %s\n", d->vcl_name);
VSB_printf(vsb, " name = %s\n", d->name);
VSB_printf(vsb, "%s = %p {\n", nm, d);
VSB_indent(vsb, 2);
VSB_printf(vsb, "vcl_name = %s\n", d->vcl_name);
VSB_printf(vsb, "type = %s {\n", d->name);
VSB_indent(vsb, 2);
if (d->panic != NULL)
d->panic(d, vsb);
VSB_printf(vsb, " }\n");
VSB_indent(vsb, -2);
VSB_printf(vsb, "}\n");
VSB_indent(vsb, -2);
VSB_printf(vsb, "}\n");
}
This diff is collapsed.
......@@ -86,12 +86,16 @@ VCL_Panic(struct vsb *vsb, const struct vcl *vcl)
AN(vsb);
if (vcl == NULL)
return;
VSB_printf(vsb, " vcl = {\n");
VSB_printf(vsb, " srcname = {\n");
VSB_printf(vsb, "vcl = {\n");
VSB_indent(vsb, 2);
VSB_printf(vsb, "srcname = {\n");
VSB_indent(vsb, 2);
for (i = 0; i < vcl->conf->nsrc; ++i)
VSB_printf(vsb, " \"%s\",\n", vcl->conf->srcname[i]);
VSB_printf(vsb, " },\n");
VSB_printf(vsb, " },\n");
VSB_printf(vsb, "\"%s\",\n", vcl->conf->srcname[i]);
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
VSB_indent(vsb, -2);
VSB_printf(vsb, "},\n");
}
/*--------------------------------------------------------------------*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment