xref: /freebsd/sbin/ipf/libipf/printlog.c (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
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(frentry_t *fp)
18 {
19 	char *s, *u;
20 
21 	PRINTF("log");
22 	if (fp->fr_flags & FR_LOGBODY)
23 		PRINTF(" body");
24 	if (fp->fr_flags & FR_LOGFIRST)
25 		PRINTF(" first");
26 	if (fp->fr_flags & FR_LOGORBLOCK)
27 		PRINTF(" or-block");
28 	if (fp->fr_loglevel != 0xffff) {
29 		PRINTF(" level ");
30 		s = fac_toname(fp->fr_loglevel);
31 		if (s == NULL || *s == '\0')
32 			s = "!!!";
33 		u = pri_toname(fp->fr_loglevel);
34 		if (u == NULL || *u == '\0')
35 			u = "!!!";
36 		PRINTF("%s.%s", s, u);
37 	}
38 }
39