1*8ead113eSnicm /* $OpenBSD: log.h,v 1.6 2010/04/21 20:02:40 nicm Exp $ */ 24643be29Sbrad 34643be29Sbrad /* 44643be29Sbrad * Copyright (c) 2000-2004 Niels Provos <provos@citi.umich.edu> 54643be29Sbrad * All rights reserved. 64643be29Sbrad * 74643be29Sbrad * Redistribution and use in source and binary forms, with or without 84643be29Sbrad * modification, are permitted provided that the following conditions 94643be29Sbrad * are met: 104643be29Sbrad * 1. Redistributions of source code must retain the above copyright 114643be29Sbrad * notice, this list of conditions and the following disclaimer. 124643be29Sbrad * 2. Redistributions in binary form must reproduce the above copyright 134643be29Sbrad * notice, this list of conditions and the following disclaimer in the 144643be29Sbrad * documentation and/or other materials provided with the distribution. 154643be29Sbrad * 3. The name of the author may not be used to endorse or promote products 164643be29Sbrad * derived from this software without specific prior written permission. 174643be29Sbrad * 184643be29Sbrad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 194643be29Sbrad * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 204643be29Sbrad * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 214643be29Sbrad * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 224643be29Sbrad * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 234643be29Sbrad * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244643be29Sbrad * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254643be29Sbrad * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264643be29Sbrad * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 274643be29Sbrad * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284643be29Sbrad */ 294643be29Sbrad #ifndef _LOG_H_ 304643be29Sbrad #define _LOG_H_ 314643be29Sbrad 32*8ead113eSnicm #ifdef __GNUC__ 33*8ead113eSnicm #define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b))) 34*8ead113eSnicm #else 35*8ead113eSnicm #define EV_CHECK_FMT(a,b) 36*8ead113eSnicm #endif 37*8ead113eSnicm 38*8ead113eSnicm void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3); 39*8ead113eSnicm void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2); 40*8ead113eSnicm void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3); 41*8ead113eSnicm void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2); 42*8ead113eSnicm void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2); 43*8ead113eSnicm void _event_debugx(const char *fmt, ...) EV_CHECK_FMT(1,2); 44bdce580dSbrad 454643be29Sbrad #ifdef USE_DEBUG 464643be29Sbrad #define event_debug(x) _event_debugx x 474643be29Sbrad #else 487567a386Smillert #define event_debug(x) do {;} while (0) 494643be29Sbrad #endif 504643be29Sbrad 51*8ead113eSnicm #undef EV_CHECK_FMT 52*8ead113eSnicm 534643be29Sbrad #endif 54