• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <stdlib.h>
4 #include "log.h"
5 
6 void
rpcapd_log_init(void)7 rpcapd_log_init(void)
8 {
9 }
10 
11 void
rpcapd_log(log_priority priority,const char * message,...)12 rpcapd_log(log_priority priority, const char *message, ...)
13 {
14 	const char *tag;
15 	va_list ap;
16 
17 	switch (priority) {
18 
19 	case LOGPRIO_INFO:
20 		tag = "";
21 		break;
22 
23 	case LOGPRIO_WARNING:
24 		tag = "warning: ";
25 		break;
26 
27 	case LOGPRIO_ERROR:
28 		tag = "error: ";
29 		break;
30 
31 	default:
32 		abort();
33 		/* NOTREACHED */
34 	}
35 
36 	fprintf(stderr, "rpcapd: %s", tag);
37 	va_start(ap, message);
38 	vfprintf(stderr, message, ap);
39 	va_end(ap);
40 	putc('\n', stderr);
41 }
42