xref: /freebsd/sbin/ipf/libipf/printlog.c (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
141edb306SCy Schubert 
241edb306SCy Schubert /*
341edb306SCy Schubert  * Copyright (C) 2012 by Darren Reed.
441edb306SCy Schubert  *
541edb306SCy Schubert  * See the IPFILTER.LICENCE file for details on licencing.
641edb306SCy Schubert  *
741edb306SCy Schubert  * $Id$
841edb306SCy Schubert  */
941edb306SCy Schubert 
1041edb306SCy Schubert #include "ipf.h"
1141edb306SCy Schubert 
1241edb306SCy Schubert #include <syslog.h>
1341edb306SCy Schubert 
1441edb306SCy Schubert 
1541edb306SCy Schubert void
printlog(frentry_t * fp)16*efeb8bffSCy Schubert printlog(frentry_t *fp)
1741edb306SCy Schubert {
1841edb306SCy Schubert 	char *s, *u;
1941edb306SCy Schubert 
2041edb306SCy Schubert 	PRINTF("log");
2141edb306SCy Schubert 	if (fp->fr_flags & FR_LOGBODY)
2241edb306SCy Schubert 		PRINTF(" body");
2341edb306SCy Schubert 	if (fp->fr_flags & FR_LOGFIRST)
2441edb306SCy Schubert 		PRINTF(" first");
2541edb306SCy Schubert 	if (fp->fr_flags & FR_LOGORBLOCK)
2641edb306SCy Schubert 		PRINTF(" or-block");
2741edb306SCy Schubert 	if (fp->fr_loglevel != 0xffff) {
2841edb306SCy Schubert 		PRINTF(" level ");
2941edb306SCy Schubert 		s = fac_toname(fp->fr_loglevel);
3041edb306SCy Schubert 		if (s == NULL || *s == '\0')
3141edb306SCy Schubert 			s = "!!!";
3241edb306SCy Schubert 		u = pri_toname(fp->fr_loglevel);
3341edb306SCy Schubert 		if (u == NULL || *u == '\0')
3441edb306SCy Schubert 			u = "!!!";
3541edb306SCy Schubert 		PRINTF("%s.%s", s, u);
3641edb306SCy Schubert 	}
3741edb306SCy Schubert }
38