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