Commit 8bf0a33a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Convert std.log() and std.syslog from STRING_LIST to STRANDS.

parent 7e14355f
......@@ -419,7 +419,7 @@ Examples::
LOGGING functions
=================
$Function VOID log(STRING_LIST s)
$Function VOID log(STRANDS s)
Logs the string *s* to the shared memory log, using :ref:`vsl(7)` tag
``SLT_VCL_Log``.
......@@ -428,7 +428,7 @@ Example::
std.log("Something fishy is going on with the vhost " + req.http.host);
$Function VOID syslog(INT priority, STRING_LIST s)
$Function VOID syslog(INT priority, STRANDS s)
Logs the string *s* to syslog tagged with *priority*. *priority* is
formed by ORing the facility and level values. See your system's
......
......@@ -129,45 +129,33 @@ vmod_random(VRT_CTX, VCL_REAL lo, VCL_REAL hi)
}
VCL_VOID v_matchproto_(td_std_log)
vmod_log(VRT_CTX, const char *fmt, ...)
vmod_log(VRT_CTX, VCL_STRANDS s)
{
const char *p;
va_list ap;
uintptr_t sn;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
sn = WS_Snapshot(ctx->ws);
va_start(ap, fmt);
p = VRT_String(ctx->ws, NULL, fmt, ap);
va_end(ap);
if (p == NULL) {
WS_Reset(ctx->ws, sn);
WS_MarkOverflow(ctx->ws);
return;
p = VRT_StrandsWS(ctx->ws, NULL, s);
if (p != NULL) {
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_Log, "%s", p);
else
VSL(SLT_VCL_Log, 0, "%s", p);
}
AN(p);
if (ctx->vsl != NULL)
VSLb(ctx->vsl, SLT_VCL_Log, "%s", p);
else
VSL(SLT_VCL_Log, 0, "%s", p);
WS_Reset(ctx->ws, sn);
}
/* XXX use vsyslog() ? */
VCL_VOID v_matchproto_(td_std_syslog)
vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...)
vmod_syslog(VRT_CTX, VCL_INT fac, VCL_STRANDS s)
{
const char *p;
va_list ap;
uintptr_t sn;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
sn = WS_Snapshot(ctx->ws);
va_start(ap, fmt);
p = VRT_String(ctx->ws, NULL, fmt, ap);
va_end(ap);
p = VRT_StrandsWS(ctx->ws, NULL, s);
if (p != NULL)
syslog((int)fac, "%s", p);
WS_Reset(ctx->ws, sn);
......
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