xref: /netbsd-src/external/bsd/ipf/dist/lib/printlog.c (revision 13885a665959c62f13a82b3caedf986eaa17aa31)
1*13885a66Sdarrenr /*	$NetBSD: printlog.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $	*/
2bc4097aaSchristos 
3bc4097aaSchristos /*
4c9d5dc6cSdarrenr  * Copyright (C) 2012 by Darren Reed.
5bc4097aaSchristos  *
6bc4097aaSchristos  * See the IPFILTER.LICENCE file for details on licencing.
7bc4097aaSchristos  *
8*13885a66Sdarrenr  * Id: printlog.c,v 1.1.1.2 2012/07/22 13:44:41 darrenr Exp $
9bc4097aaSchristos  */
10bc4097aaSchristos 
11bc4097aaSchristos #include "ipf.h"
12bc4097aaSchristos 
13bc4097aaSchristos #include <syslog.h>
14bc4097aaSchristos 
15bc4097aaSchristos 
16bc4097aaSchristos void
printlog(fp)17bc4097aaSchristos printlog(fp)
18bc4097aaSchristos 	frentry_t *fp;
19bc4097aaSchristos {
20bc4097aaSchristos 	char *s, *u;
21bc4097aaSchristos 
22bc4097aaSchristos 	PRINTF("log");
23bc4097aaSchristos 	if (fp->fr_flags & FR_LOGBODY)
24bc4097aaSchristos 		PRINTF(" body");
25bc4097aaSchristos 	if (fp->fr_flags & FR_LOGFIRST)
26bc4097aaSchristos 		PRINTF(" first");
27bc4097aaSchristos 	if (fp->fr_flags & FR_LOGORBLOCK)
28bc4097aaSchristos 		PRINTF(" or-block");
29bc4097aaSchristos 	if (fp->fr_loglevel != 0xffff) {
30bc4097aaSchristos 		PRINTF(" level ");
31bc4097aaSchristos 		s = fac_toname(fp->fr_loglevel);
32bc4097aaSchristos 		if (s == NULL || *s == '\0')
33bc4097aaSchristos 			s = "!!!";
34bc4097aaSchristos 		u = pri_toname(fp->fr_loglevel);
35bc4097aaSchristos 		if (u == NULL || *u == '\0')
36bc4097aaSchristos 			u = "!!!";
37bc4097aaSchristos 		PRINTF("%s.%s", s, u);
38bc4097aaSchristos 	}
39bc4097aaSchristos }
40