Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
8bf0a33a
Commit
8bf0a33a
authored
Jun 18, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert std.log() and std.syslog from STRING_LIST to STRANDS.
parent
7e14355f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
23 deletions
+11
-23
vmod.vcc
lib/libvmod_std/vmod.vcc
+2
-2
vmod_std.c
lib/libvmod_std/vmod_std.c
+9
-21
No files found.
lib/libvmod_std/vmod.vcc
View file @
8bf0a33a
...
@@ -419,7 +419,7 @@ Examples::
...
@@ -419,7 +419,7 @@ Examples::
LOGGING functions
LOGGING functions
=================
=================
$Function VOID log(STR
ING_LIST
s)
$Function VOID log(STR
ANDS
s)
Logs the string *s* to the shared memory log, using :ref:`vsl(7)` tag
Logs the string *s* to the shared memory log, using :ref:`vsl(7)` tag
``SLT_VCL_Log``.
``SLT_VCL_Log``.
...
@@ -428,7 +428,7 @@ Example::
...
@@ -428,7 +428,7 @@ Example::
std.log("Something fishy is going on with the vhost " + req.http.host);
std.log("Something fishy is going on with the vhost " + req.http.host);
$Function VOID syslog(INT priority, STR
ING_LIST
s)
$Function VOID syslog(INT priority, STR
ANDS
s)
Logs the string *s* to syslog tagged with *priority*. *priority* is
Logs the string *s* to syslog tagged with *priority*. *priority* is
formed by ORing the facility and level values. See your system's
formed by ORing the facility and level values. See your system's
...
...
lib/libvmod_std/vmod_std.c
View file @
8bf0a33a
...
@@ -129,45 +129,33 @@ vmod_random(VRT_CTX, VCL_REAL lo, VCL_REAL hi)
...
@@ -129,45 +129,33 @@ vmod_random(VRT_CTX, VCL_REAL lo, VCL_REAL hi)
}
}
VCL_VOID
v_matchproto_
(
td_std_log
)
VCL_VOID
v_matchproto_
(
td_std_log
)
vmod_log
(
VRT_CTX
,
const
char
*
fmt
,
...
)
vmod_log
(
VRT_CTX
,
VCL_STRANDS
s
)
{
{
const
char
*
p
;
const
char
*
p
;
va_list
ap
;
uintptr_t
sn
;
uintptr_t
sn
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
sn
=
WS_Snapshot
(
ctx
->
ws
);
sn
=
WS_Snapshot
(
ctx
->
ws
);
va_start
(
ap
,
fmt
);
p
=
VRT_StrandsWS
(
ctx
->
ws
,
NULL
,
s
);
p
=
VRT_String
(
ctx
->
ws
,
NULL
,
fmt
,
ap
);
if
(
p
!=
NULL
)
{
va_end
(
ap
);
if
(
ctx
->
vsl
!=
NULL
)
VSLb
(
ctx
->
vsl
,
SLT_VCL_Log
,
"%s"
,
p
);
if
(
p
==
NULL
)
{
else
WS_Reset
(
ctx
->
ws
,
sn
);
VSL
(
SLT_VCL_Log
,
0
,
"%s"
,
p
);
WS_MarkOverflow
(
ctx
->
ws
);
return
;
}
}
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
);
WS_Reset
(
ctx
->
ws
,
sn
);
}
}
/* XXX use vsyslog() ? */
/* XXX use vsyslog() ? */
VCL_VOID
v_matchproto_
(
td_std_syslog
)
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
;
const
char
*
p
;
va_list
ap
;
uintptr_t
sn
;
uintptr_t
sn
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
sn
=
WS_Snapshot
(
ctx
->
ws
);
sn
=
WS_Snapshot
(
ctx
->
ws
);
va_start
(
ap
,
fmt
);
p
=
VRT_StrandsWS
(
ctx
->
ws
,
NULL
,
s
);
p
=
VRT_String
(
ctx
->
ws
,
NULL
,
fmt
,
ap
);
va_end
(
ap
);
if
(
p
!=
NULL
)
if
(
p
!=
NULL
)
syslog
((
int
)
fac
,
"%s"
,
p
);
syslog
((
int
)
fac
,
"%s"
,
p
);
WS_Reset
(
ctx
->
ws
,
sn
);
WS_Reset
(
ctx
->
ws
,
sn
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment