• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

/home/pvrabec/project/openscap/openscap-0.6.6/src/common/debug_priv.h

Go to the documentation of this file.
00001 
00005 /*
00006  * Copyright 2010 Red Hat Inc., Durham, North Carolina.
00007  * All Rights Reserved.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  * Authors:
00024  *       Lukas Kuklinek <lkuklinek@redhat.com>
00025  *       Peter Vrabec <pvrabec@redhat.com>
00026  */ 
00027 
00028 #pragma once
00029 #ifndef OSCAP_DEBUG_PRIV_H_
00030 #define OSCAP_DEBUG_PRIV_H_
00031 
00032 #include "util.h"
00033 #include "public/debug.h"
00034 
00035 #if defined(NDEBUG)
00036 # define oscap_dprintf(...) while(0)
00037 # define oscap_dlprintf(...) while(0)
00038 # define debug(l) if (0)
00039 #else
00040 # include <stdlib.h>
00041 # include <stddef.h>
00042 # include <stdarg.h>
00043 
00044 enum {
00045         DBG_E = 1,
00046         DBG_W,
00047         DBG_I
00048 };
00049 
00050 # define __dlprintf_wrapper(l, ...) __oscap_dlprintf (l, __FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
00051 
00061 void __oscap_dprintf(const char *file, const char *fn, size_t line, const char *fmt, ...);
00062 
00068 # define oscap_dprintf(...) __dlprintf_wrapper (0, __VA_ARGS__)
00069 
00070 extern int __debuglog_level;
00084 # define debug(l) if ((__debuglog_level = (__debuglog_level == -1 ? atoi (getenv (OSCAP_DEBUG_LEVEL_ENV) == NULL ? "0" : getenv (OSCAP_DEBUG_LEVEL_ENV)) : __debuglog_level)) && __debuglog_level >= (l))
00085 
00096 void __oscap_dlprintf(int level, const char *file, const char *fn, size_t line, const char *fmt, ...);
00097 
00103 # define oscap_dlprintf(l, ...) __dlprintf_wrapper (l, __VA_ARGS__)
00104 #endif                          /* NDEBUG */
00105 
00106 #define dI(...) oscap_dlprintf(DBG_I, __VA_ARGS__)
00107 #define dW(...) oscap_dlprintf(DBG_W, __VA_ARGS__)
00108 #define dE(...) oscap_dlprintf(DBG_E, __VA_ARGS__)
00109 
00110 #endif

Generated on Thu Dec 9 2010 for Open SCAP Library by  doxygen 1.7.1