From: phk Date: Thu, 29 Jun 2006 15:14:15 +0000 (+0000) Subject: Improve shm-logging of VCL activity X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e1a43f8aedfc4fb005cd5a7559315f1472d9973;p=varnish Improve shm-logging of VCL activity git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@267 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vcl.c b/varnish-cache/bin/varnishd/cache_vcl.c index 73cabdda..84b85733 100644 --- a/varnish-cache/bin/varnishd/cache_vcl.c +++ b/varnish-cache/bin/varnishd/cache_vcl.c @@ -227,9 +227,10 @@ VCL_##func##_method(struct sess *sp) \ { \ \ sp->handling = 0; \ + VSL(SLT_VCL_call, sp->fd, "%s", #func); \ sp->vcl->func##_func(sp); \ CheckHandling(sp, #func, (bitmap)); \ - VSL(SLT_vcl_##func, sp->fd, "0x%x %s", sp->handling, HandlingName(sp->handling)); \ + VSL(SLT_VCL_return, sp->fd, "%s", HandlingName(sp->handling)); \ } #define VCL_RET_MAC(l,u,b) diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index cb3b1fc6..405f6f75 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -36,7 +36,7 @@ void VRT_count(struct sess *sp, unsigned u) { - VSL(SLT_VCL, sp->fd, "%u %d.%d", u, + VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u, sp->vcl->ref[u].line, sp->vcl->ref[u].pos); } diff --git a/varnish-cache/bin/varnishlog/varnishlog.c b/varnish-cache/bin/varnishlog/varnishlog.c index aa2210c6..63cdb378 100644 --- a/varnish-cache/bin/varnishlog/varnishlog.c +++ b/varnish-cache/bin/varnishlog/varnishlog.c @@ -46,14 +46,39 @@ order(unsigned char *p) ob[u] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); assert(ob[u] != NULL); } - sbuf_printf(ob[u], "%02x %3d %4d %-12s", - p[0], p[1], u, tagnames[p[0]]); - if (p[1] > 0) { - sbuf_cat(ob[u], " <"); - sbuf_bcat(ob[u], p + 4, p[1]); - sbuf_cat(ob[u], ">"); + switch (p[0]) { + case SLT_VCL_call: + sbuf_printf(ob[u], "%02x %3d %4d %-12s", + p[0], p[1], u, tagnames[p[0]]); + if (p[1] > 0) { + sbuf_cat(ob[u], " <"); + sbuf_bcat(ob[u], p + 4, p[1]); + } + break; + case SLT_VCL_trace: + if (p[1] > 0) { + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, p[1]); + } + break; + case SLT_VCL_return: + if (p[1] > 0) { + sbuf_cat(ob[u], " "); + sbuf_bcat(ob[u], p + 4, p[1]); + sbuf_cat(ob[u], ">\n"); + } + break; + default: + sbuf_printf(ob[u], "%02x %3d %4d %-12s", + p[0], p[1], u, tagnames[p[0]]); + if (p[1] > 0) { + sbuf_cat(ob[u], " <"); + sbuf_bcat(ob[u], p + 4, p[1]); + sbuf_cat(ob[u], ">"); + } + sbuf_cat(ob[u], "\n"); + break; } - sbuf_cat(ob[u], "\n"); if (u == 0) { sbuf_finish(ob[u]); printf("%s", sbuf_data(ob[u])); diff --git a/varnish-cache/include/shmlog_tags.h b/varnish-cache/include/shmlog_tags.h index 884ac024..3a5ef0fe 100644 --- a/varnish-cache/include/shmlog_tags.h +++ b/varnish-cache/include/shmlog_tags.h @@ -18,11 +18,6 @@ SLTM(BackendReuse) SLTM(BackendClose) SLTM(HttpError) SLTM(ClientAddr) -#define VCL_RET_MAC(l,u,b) -#define VCL_MET_MAC(l,u,b) SLTM(vcl_##l) -#include "vcl_returns.h" -#undef VCL_MET_MAC -#undef VCL_RET_MAC SLTM(Backend) SLTM(Request) SLTM(Response) @@ -32,7 +27,9 @@ SLTM(Protocol) SLTM(Header) SLTM(BldHdr) SLTM(LostHeader) -SLTM(VCL) +SLTM(VCL_call) +SLTM(VCL_trace) +SLTM(VCL_return) SLTM(XID) SLTM(ExpPick) SLTM(ExpKill)