Loading...
Searching...
No Matches
su_debug.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_DEBUG_H
#define SU_DEBUG_H
#ifndef SU_LOG_H
#include <sofia-sip/su_log.h>
#endif
SOFIA_BEGIN_DECLS
#ifndef SU_DEBUG_MAX
#define SU_DEBUG_MAX 9
#endif
#define SU_LOG_LEVEL \
((SU_LOG->log_init) == 0 ? 9 : \
((SU_LOG->log_init > 1) ? SU_LOG->log_level : su_log_default->log_level))
#if SU_DEBUG_MAX >= 0
#ifndef SU_LOG
#define SU_LOG (su_log_default)
#else
SOFIAPUBVAR su_log_t SU_LOG[];
#endif
#define SU_DEBUG_DEF(level) \
su_inline void su_debug_##level(char const *fmt, ...) \
__attribute__ ((__format__ (printf, 1, 2))); \
su_inline void su_debug_##level(char const *fmt, ...) \
{ va_list ap; va_start(ap, fmt); su_vllog(SU_LOG, level, fmt, ap); va_end(ap); }
SU_DEBUG_DEF(0)
#define SU_DEBUG_0(x) (su_debug_0 x)
#define SU_LERROR(s) (su_llog(SU_LOG, 1, "%s: %s\n", (s), strerror(errno)))
#define SU_LSERROR(s) \
(su_llog(SU_LOG, 1, "%s: %s\n", (s), su_strerror(su_errno())))
#else
#define SU_DEBUG_0(x) ((void)0)
#define SU_LERROR(s) ((void)0)
#define SU_LSERROR(s) ((void)0)
#endif
#if SU_DEBUG_MAX >= 1
SU_DEBUG_DEF(1)
#define SU_DEBUG_1(x) (SU_LOG_LEVEL >= 1 ? (su_debug_1 x) : (void)0)
#else
#define SU_DEBUG_1(x) (void)1
#endif
#if SU_DEBUG_MAX >= 2
SU_DEBUG_DEF(2)
#define SU_DEBUG_2(x) (SU_LOG_LEVEL >= 2 ? (su_debug_2 x) : (void)0)
#else
#define SU_DEBUG_2(x) (void)2
#endif
#if SU_DEBUG_MAX >= 3
SU_DEBUG_DEF(3)
#define SU_DEBUG_3(x) (SU_LOG_LEVEL >= 3 ? (su_debug_3 x) : (void)0)
#else
#define SU_DEBUG_3(x) (void)3
#endif
#if SU_DEBUG_MAX >= 4
SU_DEBUG_DEF(4)
#define SU_DEBUG_4(x) (SU_LOG_LEVEL >= 4 ? (su_debug_4 x) : (void)0)
#else
#define SU_DEBUG_4(x) (void)4
#endif
#if SU_DEBUG_MAX >= 5
SU_DEBUG_DEF(5)
#define SU_DEBUG_5(x) (SU_LOG_LEVEL >= 5 ? (su_debug_5 x) : (void)0)
#else
#define SU_DEBUG_5(x) (void)5
#endif
#if SU_DEBUG_MAX >= 6
SU_DEBUG_DEF(6)
#define SU_DEBUG_6(x) (SU_LOG_LEVEL >= 6 ? (su_debug_6 x) : (void)0)
#else
#define SU_DEBUG_6(x) (void)6
#endif
#if SU_DEBUG_MAX >= 7
SU_DEBUG_DEF(7)
#define SU_DEBUG_7(x) (SU_LOG_LEVEL >= 7 ? (su_debug_7 x) : (void)0)
#else
#define SU_DEBUG_7(x) (void)7
#endif
#if SU_DEBUG_MAX >= 8
SU_DEBUG_DEF(8)
#define SU_DEBUG_8(x) (SU_LOG_LEVEL >= 8 ? (su_debug_8 x) : (void)0)
#else
#define SU_DEBUG_8(x) (void)8
#endif
#if SU_DEBUG_MAX >= 9
SU_DEBUG_DEF(9)
#define SU_DEBUG_9(x) (SU_LOG_LEVEL >= 9 ? (su_debug_9 x) : (void)0)
#else
#define SU_DEBUG_9(x) (void)9
#endif
SOFIA_END_DECLS
#endif /* SU_DEBUG_H */
SOFIAPUBVAR
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition su_config.h:68
su_log.h
SU logging interface.
su_log_t
struct su_log_s su_log_t
Type of log structure.
Definition su_log.h:38

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.