1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* This file is part of dnsjit.
*
* dnsjit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* dnsjit 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with dnsjit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __dnsjit_core_log_h
#define __dnsjit_core_log_h
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
#define LOG_SETTINGS_T_INIT \
{ \
0, 0, 0, 0, 0 \
}
#define LOG_T_INIT(name) \
{ \
name, 0, LOG_SETTINGS_T_INIT, 0 \
}
#define LOG_T_INIT_OBJ(name) \
{ \
name, 1, LOG_SETTINGS_T_INIT, &_log.settings \
}
#include <dnsjit/core/log.hh>
#ifdef DNSJIT_NO_LOGGING
#define ldebug(msg...)
#define linfo(msg...)
#define lnotice(msg...)
#define lwarning(msg...)
#define lcritical(msg...)
#define lpdebug(msg...)
#define lpinfo(msg...)
#define lpnotice(msg...)
#define lpwarning(msg...)
#define lpcritical(msg...)
#define mldebug(msg...)
#define mlinfo(msg...)
#define mlnotice(msg...)
#define mlwarning(msg...)
#define mlcritical(msg...)
#define gldebug(msg...)
#define glinfo(msg...)
#define glnotice(msg...)
#define glwarning(msg...)
#define glcritical(msg...)
#else
#define ldebug(msg...) core_log_debug(&self->_log, __FILE__, __LINE__, msg)
#define linfo(msg...) core_log_info(&self->_log, __FILE__, __LINE__, msg)
#define lnotice(msg...) core_log_notice(&self->_log, __FILE__, __LINE__, msg)
#define lwarning(msg...) core_log_warning(&self->_log, __FILE__, __LINE__, msg)
#define lcritical(msg...) core_log_critical(&self->_log, __FILE__, __LINE__, msg)
#define lpdebug(msg...) core_log_debug(self->_log, __FILE__, __LINE__, msg)
#define lpinfo(msg...) core_log_info(self->_log, __FILE__, __LINE__, msg)
#define lpnotice(msg...) core_log_notice(self->_log, __FILE__, __LINE__, msg)
#define lpwarning(msg...) core_log_warning(self->_log, __FILE__, __LINE__, msg)
#define lpcritical(msg...) core_log_critical(self->_log, __FILE__, __LINE__, msg)
#define mldebug(msg...) core_log_debug(&_log, __FILE__, __LINE__, msg)
#define mlinfo(msg...) core_log_info(&_log, __FILE__, __LINE__, msg)
#define mlnotice(msg...) core_log_notice(&_log, __FILE__, __LINE__, msg)
#define mlwarning(msg...) core_log_warning(&_log, __FILE__, __LINE__, msg)
#define mlcritical(msg...) core_log_critical(&_log, __FILE__, __LINE__, msg)
#define gldebug(msg...) core_log_debug(0, __FILE__, __LINE__, msg)
#define glinfo(msg...) core_log_info(0, __FILE__, __LINE__, msg)
#define glnotice(msg...) core_log_notice(0, __FILE__, __LINE__, msg)
#define glwarning(msg...) core_log_warning(0, __FILE__, __LINE__, msg)
#define glcritical(msg...) core_log_critical(0, __FILE__, __LINE__, msg)
#endif
#define lfatal(msg...) core_log_fatal(&self->_log, __FILE__, __LINE__, msg)
#define lpfatal(msg...) core_log_fatal(self->_log, __FILE__, __LINE__, msg)
#define mlfatal(msg...) core_log_fatal(&_log, __FILE__, __LINE__, msg)
#define glfatal(msg...) core_log_fatal(0, __FILE__, __LINE__, msg)
#define lfatal_oom(expression) \
if (!(expression)) \
core_log_fatal(&self->_log, __FILE__, __LINE__, "out of memory")
#define lpfatal_oom(expression) \
if (!(expression)) \
core_log_fatal(self->_log, __FILE__, __LINE__, "out of memory")
#define mlfatal_oom(expression) \
if (!(expression)) \
core_log_fatal(&_log, __FILE__, __LINE__, "out of memory")
#define glfatal_oom(expression) \
if (!(expression)) \
core_log_fatal(0, __FILE__, __LINE__, "out of memory")
#endif
|