preCICE
v3.2.0
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
h
i
m
n
p
r
s
t
Typedefs
b
d
e
g
l
m
p
r
s
t
u
v
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
Variables
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
i
k
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
c
d
e
i
l
m
n
o
r
s
u
v
w
Related Symbols
Files
File List
File Members
All
_
a
b
c
d
e
g
i
j
m
n
o
p
r
s
t
v
Functions
a
b
c
g
m
p
r
s
t
v
Variables
Typedefs
Macros
b
d
m
n
p
t
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
src
logging
LogMacros.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
precice/Exceptions.hpp
"
4
#include "
utils/fmt.hpp
"
5
6
#define PRECICE_LOG_LOCATION \
7
precice::logging::LogLocation \
8
{ \
9
__FILE__, __LINE__, __func__ \
10
}
6
#define PRECICE_LOG_LOCATION \
…
11
12
#define PRECICE_WARN(...) _log.warning(PRECICE_LOG_LOCATION, precice::utils::format_or_error(__VA_ARGS__))
13
14
#define PRECICE_INFO(...) _log.info(PRECICE_LOG_LOCATION, precice::utils::format_or_error(__VA_ARGS__))
15
16
#define PRECICE_ERROR(...) ::precice::logging::logErrorAndThrow<::precice::Error>(_log, PRECICE_LOG_LOCATION, precice::utils::format_or_error(__VA_ARGS__))
17
18
#define PRECICE_WARN_IF(condition, ...) \
19
do { \
20
if (condition) { \
21
PRECICE_WARN(__VA_ARGS__); \
22
} \
23
} while (false)
18
#define PRECICE_WARN_IF(condition, ...) \
…
24
25
#define PRECICE_INFO_IF(condition, ...) \
26
do { \
27
if (condition) { \
28
PRECICE_INFO(__VA_ARGS__); \
29
} \
30
} while (false)
25
#define PRECICE_INFO_IF(condition, ...) \
…
31
32
#define PRECICE_CHECK(check, ...) \
33
do { \
34
if (!(check)) { \
35
PRECICE_ERROR(__VA_ARGS__); \
36
} \
37
} while (false)
32
#define PRECICE_CHECK(check, ...) \
…
38
39
// Debug logging is disabled in release (NDEBUG) builds by default.
40
// To enable it anyhow, enable the CMake option PRECICE_RELEASE_WITH_DEBUG_LOG.
41
42
#if defined(NDEBUG) && !defined(PRECICE_RELEASE_WITH_DEBUG_LOG)
43
#define PRECICE_NO_DEBUG_LOG
44
#endif
45
46
#ifdef PRECICE_NO_DEBUG_LOG
47
48
#include "
utils/ignore.hpp
"
49
50
#define PRECICE_DEBUG(...) \
51
::precice::utils::ignore(__VA_ARGS__)
52
53
#define PRECICE_DEBUG_IF(...) \
54
::precice::utils::ignore(__VA_ARGS__)
55
56
#define PRECICE_TRACE(...) \
57
::precice::utils::ignore(__VA_ARGS__)
58
59
#else
// PRECICE_NO_DEBUG_LOG
60
61
#define PRECICE_DEBUG(...) _log.debug(PRECICE_LOG_LOCATION, precice::utils::format_or_error(__VA_ARGS__))
62
63
#define PRECICE_DEBUG_IF(condition, ...) \
64
do { \
65
if (condition) { \
66
PRECICE_DEBUG(__VA_ARGS__); \
67
} \
68
} while (false)
63
#define PRECICE_DEBUG_IF(condition, ...) \
…
69
70
#endif
// ! PRECICE_NO_DEBUG_LOG
71
72
// Trace logging is disabled in release (NDEBUG) builds by default.
73
// To enable it anyhow, enable the CMake option PRECICE_RELEASE_WITH_TRACE_LOG.
74
75
#if defined(NDEBUG) && !defined(PRECICE_RELEASE_WITH_TRACE_LOG)
76
#define PRECICE_NO_TRACE_LOG
77
#endif
78
79
#ifdef PRECICE_NO_TRACE_LOG
80
81
#include "
utils/ignore.hpp
"
82
83
#define PRECICE_TRACE(...) \
84
::precice::utils::ignore(__VA_ARGS__)
85
86
#else
// PRECICE_NO_TRACE_LOG
87
88
#include "
logging/Tracer.hpp
"
89
#include "
utils/ArgumentFormatter.hpp
"
90
91
// Do not put do {...} while (false) here, it will destroy the _tracer_ right after creation
92
#define PRECICE_TRACE(...) \
93
precice::logging::Tracer _tracer_(_log, PRECICE_LOG_LOCATION); \
94
_log.trace(PRECICE_LOG_LOCATION, std::string{"Entering "} + __func__ + PRECICE_LOG_ARGUMENTS(__VA_ARGS__))
92
#define PRECICE_TRACE(...) \
…
95
96
#endif
// ! PRECICE_NO_TRACE_LOG
ArgumentFormatter.hpp
Exceptions.hpp
Tracer.hpp
fmt.hpp
ignore.hpp