Commit 8f465d36 authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Lasse Karstensen

Make std.log() work from vcl_{init,fini}

Fixes #1924.
parent 8fabd4aa
varnishtest "Test std.log from vcl_{init,fini}"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_init {
std.log("init");
}
sub vcl_fini {
std.log("fini");
}
} -start
varnish v1 -vcl+backend { }
varnish v1 -cliok "vcl.discard vcl1"
......@@ -139,17 +139,20 @@ vmod_log(VRT_CTX, const char *fmt, ...)
txt t;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
u = WS_Reserve(ctx->ws, 0);
t.b = ctx->ws->f;
va_start(ap, fmt);
t.e = VRT_StringList(ctx->ws->f, u, fmt, ap);
if (ctx->vsl != NULL) {
u = WS_Reserve(ctx->ws, 0);
t.b = ctx->ws->f;
t.e = VRT_StringList(ctx->ws->f, u, fmt, ap);
if (t.e != NULL) {
assert(t.e > t.b);
t.e--;
VSLbt(ctx->vsl, SLT_VCL_Log, t);
}
WS_Release(ctx->ws, 0);
} else
VSLv(SLT_VCL_Log, 0, fmt, ap);
va_end(ap);
if (t.e != NULL) {
assert(t.e > t.b);
t.e--;
VSLbt(ctx->vsl, SLT_VCL_Log, t);
}
WS_Release(ctx->ws, 0);
}
VCL_VOID __match_proto__(td_std_syslog)
......
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