Blame libevent/log-internal.h

Packit e9ba0d
/*
Packit e9ba0d
 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
Packit e9ba0d
 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
Packit e9ba0d
 *
Packit e9ba0d
 * Redistribution and use in source and binary forms, with or without
Packit e9ba0d
 * modification, are permitted provided that the following conditions
Packit e9ba0d
 * are met:
Packit e9ba0d
 * 1. Redistributions of source code must retain the above copyright
Packit e9ba0d
 *    notice, this list of conditions and the following disclaimer.
Packit e9ba0d
 * 2. Redistributions in binary form must reproduce the above copyright
Packit e9ba0d
 *    notice, this list of conditions and the following disclaimer in the
Packit e9ba0d
 *    documentation and/or other materials provided with the distribution.
Packit e9ba0d
 * 3. The name of the author may not be used to endorse or promote products
Packit e9ba0d
 *    derived from this software without specific prior written permission.
Packit e9ba0d
 *
Packit e9ba0d
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
Packit e9ba0d
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Packit e9ba0d
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Packit e9ba0d
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit e9ba0d
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Packit e9ba0d
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit e9ba0d
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit e9ba0d
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit e9ba0d
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
Packit e9ba0d
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit e9ba0d
 */
Packit e9ba0d
#ifndef _LOG_H_
Packit e9ba0d
#define _LOG_H_
Packit e9ba0d
Packit e9ba0d
#include "event2/util.h"
Packit e9ba0d
Packit e9ba0d
#ifdef __GNUC__
Packit e9ba0d
#define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b)))
Packit e9ba0d
#define EV_NORETURN __attribute__((noreturn))
Packit e9ba0d
#else
Packit e9ba0d
#define EV_CHECK_FMT(a,b)
Packit e9ba0d
#define EV_NORETURN
Packit e9ba0d
#endif
Packit e9ba0d
Packit e9ba0d
#define _EVENT_ERR_ABORT ((int)0xdeaddead)
Packit e9ba0d
Packit e9ba0d
void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
Packit e9ba0d
void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2);
Packit e9ba0d
void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN;
Packit e9ba0d
void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3);
Packit e9ba0d
void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
Packit e9ba0d
void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2);
Packit e9ba0d
void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2);
Packit e9ba0d
void _event_debugx(const char *fmt, ...) EV_CHECK_FMT(1,2);
Packit e9ba0d
Packit e9ba0d
#ifdef USE_DEBUG
Packit e9ba0d
#define event_debug(x) _event_debugx x
Packit e9ba0d
#else
Packit e9ba0d
#define event_debug(x) do {;} while (0)
Packit e9ba0d
#endif
Packit e9ba0d
Packit e9ba0d
#undef EV_CHECK_FMT
Packit e9ba0d
Packit e9ba0d
#endif