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
fd76408f
Commit
fd76408f
authored
Nov 23, 2020
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnishlog: New -u option for unbuffered output
The option was present in libvarnishapi but never exposed.
parent
12fca058
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
varnishlog.c
bin/varnishlog/varnishlog.c
+6
-1
varnishlog_options.h
bin/varnishlog/varnishlog_options.h
+7
-0
No files found.
bin/varnishlog/varnishlog.c
View file @
fd76408f
...
@@ -60,6 +60,7 @@ static struct log {
...
@@ -60,6 +60,7 @@ static struct log {
/* Options */
/* Options */
int
a_opt
;
int
a_opt
;
int
A_opt
;
int
A_opt
;
int
u_opt
;
char
*
w_arg
;
char
*
w_arg
;
/* State */
/* State */
...
@@ -74,7 +75,7 @@ openout(int append)
...
@@ -74,7 +75,7 @@ openout(int append)
if
(
LOG
.
A_opt
)
if
(
LOG
.
A_opt
)
LOG
.
fo
=
fopen
(
LOG
.
w_arg
,
append
?
"a"
:
"w"
);
LOG
.
fo
=
fopen
(
LOG
.
w_arg
,
append
?
"a"
:
"w"
);
else
else
LOG
.
fo
=
VSL_WriteOpen
(
vut
->
vsl
,
LOG
.
w_arg
,
append
,
0
);
LOG
.
fo
=
VSL_WriteOpen
(
vut
->
vsl
,
LOG
.
w_arg
,
append
,
LOG
.
u_opt
);
if
(
LOG
.
fo
==
NULL
)
if
(
LOG
.
fo
==
NULL
)
VUT_Error
(
vut
,
2
,
"Cannot open output file (%s)"
,
VUT_Error
(
vut
,
2
,
"Cannot open output file (%s)"
,
LOG
.
A_opt
?
strerror
(
errno
)
:
VSL_Error
(
vut
->
vsl
));
LOG
.
A_opt
?
strerror
(
errno
)
:
VSL_Error
(
vut
->
vsl
));
...
@@ -127,6 +128,10 @@ main(int argc, char * const *argv)
...
@@ -127,6 +128,10 @@ main(int argc, char * const *argv)
case
'h'
:
case
'h'
:
/* Usage help */
/* Usage help */
VUT_Usage
(
vut
,
&
vopt_spec
,
0
);
VUT_Usage
(
vut
,
&
vopt_spec
,
0
);
case
'u'
:
/* Unbuffered output */
LOG
.
u_opt
=
1
;
break
;
case
'w'
:
case
'w'
:
/* Write to file */
/* Write to file */
REPLACE
(
LOG
.
w_arg
,
optarg
);
REPLACE
(
LOG
.
w_arg
,
optarg
);
...
...
bin/varnishlog/varnishlog_options.h
View file @
fd76408f
...
@@ -44,6 +44,12 @@
...
@@ -44,6 +44,12 @@
" data in ascii format." \
" data in ascii format." \
)
)
#define LOG_OPT_u \
VOPT("u", "[-u]", "Unbuffered output", \
"When writing output to a file with the -w option, output" \
" data is not buffered." \
)
#define LOG_OPT_w \
#define LOG_OPT_w \
VOPT("w:", "[-w <filename>]", "Output filename", \
VOPT("w:", "[-w <filename>]", "Output filename", \
"Redirect output to file. The file will be overwritten" \
"Redirect output to file. The file will be overwritten" \
...
@@ -77,6 +83,7 @@ VUT_OPT_r
...
@@ -77,6 +83,7 @@ VUT_OPT_r
VSL_OPT_R
VSL_OPT_R
VUT_OPT_t
VUT_OPT_t
VSL_OPT_T
VSL_OPT_T
LOG_OPT_u
VSL_OPT_v
VSL_OPT_v
VUT_GLOBAL_OPT_V
VUT_GLOBAL_OPT_V
LOG_OPT_w
LOG_OPT_w
...
...
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