xref: /freebsd/contrib/ntp/sntp/log.c (revision bd81e07d2761cf1c13063eb49a5c0cb4a6951318)
1 #include <config.h>
2 
3 #include "log.h"
4 
5 char *progname;		/* for msyslog use too */
6 
7 static void cleanup_log(void);
8 
9 void
10 sntp_init_logging(
11 	const char *prog
12 	)
13 {
14 	msyslog_term = TRUE;
15 	init_logging(prog, 0, FALSE);
16 	msyslog_term_pid = FALSE;
17 	msyslog_include_timestamp = FALSE;
18 }
19 
20 
21 void
22 open_logfile(
23 	const char *logfile
24 	)
25 {
26 	change_logfile(logfile, FALSE);
27 	atexit(cleanup_log);
28 }
29 
30 
31 static void
32 cleanup_log(void)
33 {
34 	syslogit = TRUE;
35 	fflush(syslog_file);
36 	fclose(syslog_file);
37 	syslog_file = NULL;
38 }
39