Beispiel #1
0
void
vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len)
{
	char buf[64];

	AN(pfx);
	GET_VL(vl);
	if (str == NULL)
		vtc_leadin(vl, lvl, "%s(null)\n", pfx);
	else {
		bprintf(buf, "%s %-4s %4.1f %s|",
		    lead[lvl < 0 ? 1: lvl], vl->id, vl->tx, pfx);
		if (len < 0)
			len = strlen(str);
		VSB_quote_pfx(vl->vsb, buf, str,
		    len > MAX_DUMP ? MAX_DUMP : len, VSB_QUOTE_UNSAFE);
		if (len > MAX_DUMP)
			VSB_printf(vl->vsb, "%s [...] (%d)\n",
			    buf, len - MAX_DUMP);
	}
	REL_VL(vl);
	if (lvl == 0)
		vtc_logfail();
}
Beispiel #2
0
void
VSB_quote(struct vsb *s, const void *v, int len, int how)
{
	VSB_quote_pfx(s, "", v, len, how);
}