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