Syslog with inline C

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Jan 20 13:06:00 CET 2009


In message <20090120110500.GA33398 at fupp.net>, Anders Nordby writes:
>Hi,
>
>I want to use syslog() two places in vcl_recv.
>
>If I put this one two places:
>
>C{
>	#include <syslog.h>
>	syslog(LOG_ERR, "Bogus request: %s/%s", VRT_GetHdr(sp, HDR_REQ, "\005host:"), VRT_r_req_url(sp));
>}C

Outside of any subroutine, you must do the includes, and the calls obviously
from inside:

	C{
	#include <syslog.h>
	}C

	sub vcl_recv {
		C{
		syslog(LOG_ERR, "foobar");
		}C
	}

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list