Commit a84565a4 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Two minor logging fixes:

 
 - change the type of vsl_handler()'s tag argument from unsigned int to
   enum shmlogtag to allow gcc to check switch statements and gdb to show
   its value by name rather than by number.
 
 - fix the "missing newline after VCL_call" bug in varnishlog (#95)


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1372 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent de88c2e8
...@@ -112,7 +112,7 @@ r_hist(void) ...@@ -112,7 +112,7 @@ r_hist(void)
} }
static int static int
h_hist(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) h_hist(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{ {
double b; double b;
int i, j; int i, j;
......
...@@ -94,7 +94,7 @@ clean_order(void) ...@@ -94,7 +94,7 @@ clean_order(void)
} }
static int static int
h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{ {
(void)priv; (void)priv;
...@@ -114,7 +114,7 @@ h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, cons ...@@ -114,7 +114,7 @@ h_order(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, cons
switch (tag) { switch (tag) {
case SLT_VCL_call: case SLT_VCL_call:
flg[fd] |= F_INVCL; flg[fd] |= F_INVCL;
vsb_printf(ob[fd], "%5d %-12s %c %.*s", vsb_printf(ob[fd], "%5d %-12s %c %.*s\n",
fd, VSL_tags[tag], fd, VSL_tags[tag],
((spec & VSL_S_CLIENT) ? 'c' : \ ((spec & VSL_S_CLIENT) ? 'c' : \
(spec & VSL_S_BACKEND) ? 'b' : '-'), (spec & VSL_S_BACKEND) ? 'b' : '-'),
......
...@@ -164,7 +164,7 @@ trimline(const char *str, const char *end) ...@@ -164,7 +164,7 @@ trimline(const char *str, const char *end)
} }
static int static int
h_ncsa(void *priv, unsigned tag, unsigned fd, h_ncsa(void *priv, enum shmlogtag tag, unsigned fd,
unsigned len, unsigned spec, const char *ptr) unsigned len, unsigned spec, const char *ptr)
{ {
const char *end, *next; const char *end, *next;
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#ifndef VARNISHAPI_H_INCLUDED #ifndef VARNISHAPI_H_INCLUDED
#define VARNISHAPI_H_INCLUDED #define VARNISHAPI_H_INCLUDED
#include "shmlog.h"
#define V_DEAD __attribute__ ((noreturn)) #define V_DEAD __attribute__ ((noreturn))
/* base64.c */ /* base64.c */
...@@ -39,7 +41,7 @@ void base64_init(void); ...@@ -39,7 +41,7 @@ void base64_init(void);
int base64_decode(char *d, unsigned dlen, const char *s); int base64_decode(char *d, unsigned dlen, const char *s);
/* shmlog.c */ /* shmlog.c */
typedef int vsl_handler(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr);
#define VSL_S_CLIENT (1 << 0) #define VSL_S_CLIENT (1 << 0)
#define VSL_S_BACKEND (1 << 1) #define VSL_S_BACKEND (1 << 1)
#define VSL_ARGS "bCcdI:i:r:X:x:" #define VSL_ARGS "bCcdI:i:r:X:x:"
......
...@@ -326,7 +326,7 @@ VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv) ...@@ -326,7 +326,7 @@ VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
int int
VSL_H_Print(void *priv, unsigned tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr)
{ {
FILE *fo = priv; FILE *fo = priv;
......
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