4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
6 * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * $Id: log.c,v 1.1 2004/01/07 23:15:00 max Exp $
34 #include <sys/types.h>
39 log_open(char const *prog, int32_t log2stderr)
41 openlog(prog, LOG_PID|LOG_NDELAY|(log2stderr? LOG_PERROR:0), LOG_USER);
51 log_emerg(char const *message, ...)
55 va_start(ap, message);
56 vsyslog(LOG_EMERG, message, ap);
61 log_alert(char const *message, ...)
65 va_start(ap, message);
66 vsyslog(LOG_ALERT, message, ap);
71 log_crit(char const *message, ...)
75 va_start(ap, message);
76 vsyslog(LOG_CRIT, message, ap);
81 log_err(char const *message, ...)
85 va_start(ap, message);
86 vsyslog(LOG_ERR, message, ap);
91 log_warning(char const *message, ...)
95 va_start(ap, message);
96 vsyslog(LOG_WARNING, message, ap);
101 log_notice(char const *message, ...)
105 va_start(ap, message);
106 vsyslog(LOG_NOTICE, message, ap);
111 log_info(char const *message, ...)
115 va_start(ap, message);
116 vsyslog(LOG_INFO, message, ap);
121 log_debug(char const *message, ...)
125 va_start(ap, message);
126 vsyslog(LOG_DEBUG, message, ap);