Open SCAP Library
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
common
debug_priv.h
Go to the documentation of this file.
1
5
/*
6
* Copyright 2011 Red Hat Inc., Durham, North Carolina.
7
* All Rights Reserved.
8
*
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
13
*
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
*
23
* Authors:
24
* Daniel Kopecek <dkopecek@redhat.com>
25
* Peter Vrabec <pvrabec@redhat.com>
26
*/
27
28
#pragma once
29
#ifndef OSCAP_DEBUG_PRIV_H_
30
#define OSCAP_DEBUG_PRIV_H_
31
32
#include "util.h"
33
39
#ifndef OSCAP_DEBUG_FILE
40
# define OSCAP_DEBUG_FILE "oscap_debug.log"
41
#endif
42
47
#ifndef OSCAP_DEBUG_FILE_ENV
48
# define OSCAP_DEBUG_FILE_ENV "OSCAP_DEBUG_FILE"
49
#endif
50
57
#ifndef OSCAP_DEBUG_LEVEL_ENV
58
# define OSCAP_DEBUG_LEVEL_ENV "OSCAP_DEBUG_LEVEL"
59
#endif
60
69
#ifndef OSCAP_DEBUG_PATHSTRIP_ENV
70
# define OSCAP_DEBUG_PATHSTRIP_ENV "OSCAP_DEBUG_PSTRIP"
71
#endif
72
73
74
#define OSCAP_DEBUGOBJ_SEXP 1
75
76
#include <assert.h>
77
#ifndef _A
78
#define _A(x) assert(x)
79
#endif
80
81
#if defined(NDEBUG)
82
# define oscap_dlprintf(...) while(0)
83
# define debug(l) if (0)
84
# define dO(type, obj) while(0)
85
#else
86
# include <stdlib.h>
87
# include <stddef.h>
88
# include <stdarg.h>
89
90
enum
{
91
DBG_E = 1,
92
DBG_W,
93
DBG_I
94
};
95
96
# define __dlprintf_wrapper(l, ...) __oscap_dlprintf (l, __FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
97
98
extern
int
__debuglog_level;
99
113
# 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))
114
125
void
__oscap_dlprintf(
int
level,
const
char
*file,
const
char
*fn,
size_t
line,
const
char
*fmt, ...);
126
132
# define oscap_dlprintf(l, ...) __dlprintf_wrapper (l, __VA_ARGS__)
133
134
void
__oscap_debuglog_object (
const
char
*file,
const
char
*fn,
size_t
line,
int
objtype,
void
*obj);
135
136
# define dO(type, obj) __oscap_debuglog_object(__FILE__, __PRETTY_FUNCTION__, __LINE__, type, obj)
137
138
#endif
/* NDEBUG */
139
140
#define dI(...) oscap_dlprintf(DBG_I, __VA_ARGS__)
141
#define dW(...) oscap_dlprintf(DBG_W, __VA_ARGS__)
142
#define dE(...) oscap_dlprintf(DBG_E, __VA_ARGS__)
143
144
#endif
Generated by
1.8.3.1