Commit 5b4b0974 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

VSL_H_Print() prints a 'b' in the third column for backend-related log

entries, a 'c' for client-related log entries, and a ' ' for everything
else (CLI Ping for instance).  This makes it hard to process logs with
awk or similar tools, since the number of columns varies.  Therefore,
change the character used for non-backend-or-client log entries to '-'.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2591 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 425c664a
......@@ -363,11 +363,15 @@ int
VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{
FILE *fo = priv;
int type;
assert(fo != NULL);
type = (spec & VSL_S_CLIENT) ? 'c' :
(spec & VSL_S_BACKEND) ? 'b' : '-';
if (tag == SLT_Debug) {
fprintf(fo, "%5d %-12s %c \"", fd, VSL_tags[tag],
((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '));
fprintf(fo, "%5d %-12s %c \"", fd, VSL_tags[tag], type);
while (len-- > 0) {
if (*ptr >= ' ' && *ptr <= '~')
fprintf(fo, "%c", *ptr);
......@@ -378,10 +382,7 @@ VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned
fprintf(fo, "\"\n");
return (0);
}
fprintf(fo, "%5d %-12s %c %.*s\n",
fd, VSL_tags[tag],
((spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : ' '),
len, ptr);
fprintf(fo, "%5d %-12s %c %.*s\n", fd, VSL_tags[tag], type, len, ptr);
return (0);
}
......
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