xref: /openbsd-src/sbin/dhcpleased/log.h (revision 7ab22e6645be6d2f935cac2fb56c1d898e5bf9f9)
1*7ab22e66Sflorian /*	$OpenBSD: log.h,v 1.5 2024/07/14 08:45:05 florian Exp $ */
257419a7fSflorian 
357419a7fSflorian /*
457419a7fSflorian  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
557419a7fSflorian  *
657419a7fSflorian  * Permission to use, copy, modify, and distribute this software for any
757419a7fSflorian  * purpose with or without fee is hereby granted, provided that the above
857419a7fSflorian  * copyright notice and this permission notice appear in all copies.
957419a7fSflorian  *
1057419a7fSflorian  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1157419a7fSflorian  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1257419a7fSflorian  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1357419a7fSflorian  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1457419a7fSflorian  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1557419a7fSflorian  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1657419a7fSflorian  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1757419a7fSflorian  */
1857419a7fSflorian 
1957419a7fSflorian #ifndef LOG_H
2057419a7fSflorian #define LOG_H
2157419a7fSflorian 
224730fc81Sflorian #include <stdarg.h>
234730fc81Sflorian #include <stdlib.h>
2457419a7fSflorian 
2557419a7fSflorian #ifndef	SMALL
2657419a7fSflorian void	log_init(int, int);
2757419a7fSflorian void	log_procinit(const char *);
2857419a7fSflorian void	log_setverbose(int);
2957419a7fSflorian int	log_getverbose(void);
3057419a7fSflorian void	log_warn(const char *, ...)
3157419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
3257419a7fSflorian void	log_warnx(const char *, ...)
3357419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
3457419a7fSflorian void	log_info(const char *, ...)
3557419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
3657419a7fSflorian void	log_debug(const char *, ...)
3757419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
3857419a7fSflorian void	logit(int, const char *, ...)
3957419a7fSflorian 	    __attribute__((__format__ (printf, 2, 3)));
4057419a7fSflorian void	vlog(int, const char *, va_list)
4157419a7fSflorian 	    __attribute__((__format__ (printf, 2, 0)));
4257419a7fSflorian __dead void fatal(const char *, ...)
4357419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
4457419a7fSflorian __dead void fatalx(const char *, ...)
4557419a7fSflorian 	    __attribute__((__format__ (printf, 1, 2)));
4657419a7fSflorian #else
4757419a7fSflorian #define log_init(x...)		do {} while (0)
4857419a7fSflorian #define log_procinit(x...)	do {} while (0)
4957419a7fSflorian #define log_setverbose(x...)	do {} while (0)
50*7ab22e66Sflorian #define log_getverbose()	(0)
5157419a7fSflorian #define log_warn(x...)		do {} while (0)
5257419a7fSflorian #define log_warnx(x...)		do {} while (0)
5357419a7fSflorian #define log_info(x...)		do {} while (0)
5457419a7fSflorian #define log_debug(x...)		do {} while (0)
5557419a7fSflorian #define logit(x...)		do {} while (0)
5657419a7fSflorian #define vlog(x...)		do {} while (0)
5757419a7fSflorian #define fatal(x...)		exit(1)
5857419a7fSflorian #define fatalx(x...)		exit(1)
5957419a7fSflorian #endif	/* SMALL */
6057419a7fSflorian 
6157419a7fSflorian #endif /* LOG_H */
62