opensurgsim
SurgSim
Framework
LogMacros.h
Go to the documentation of this file.
1
// This file is a part of the OpenSurgSim project.
2
// Copyright 2013, SimQuest Solutions Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
20
21
#ifndef SURGSIM_FRAMEWORK_LOGMACROS_H
22
#define SURGSIM_FRAMEWORK_LOGMACROS_H
23
24
#include "SurgSim/Framework/Logger.h"
25
#include "SurgSim/Framework/LogMessage.h"
26
27
namespace
SurgSim
28
{
29
namespace
Framework
30
{
31
34
44
#define SURGSIM_LOG_LEVEL(level) ::SurgSim::Framework::LOG_LEVEL_ ## level
45
60
#define SURGSIM_LOG(logger, level) \
61
if (SURGSIM_LOG_LEVEL(level) < (logger)->getThreshold()) \
62
{ \
63
} \
64
else \
65
/* important: no curly braces around this! */
\
66
::SurgSim::Framework::LogMessage((logger), SURGSIM_LOG_LEVEL(level))
67
76
#define SURGSIM_LOG_DEBUG(logger) SURGSIM_LOG(logger, DEBUG)
77
86
#define SURGSIM_LOG_INFO(logger) SURGSIM_LOG(logger, INFO)
87
96
#define SURGSIM_LOG_WARNING(logger) SURGSIM_LOG(logger, WARNING)
97
106
#define SURGSIM_LOG_SEVERE(logger) SURGSIM_LOG(logger, SEVERE)
107
117
#define SURGSIM_LOG_CRITICAL(logger) SURGSIM_LOG(logger, CRITICAL)
118
119
135
#define SURGSIM_LOG_IF(condition, logger, level) \
136
if (! (condition)) \
137
{ \
138
} \
139
else \
140
/* important: no curly braces around this! */
\
141
SURGSIM_LOG(logger, level)
142
147
#define SURGSIM_FLAG_VARIABLE_NAME_HELPER(base, line) base ## line
148
#define SURGSIM_FLAG_VARIABLE_NAME(base, line) SURGSIM_FLAG_VARIABLE_NAME_HELPER(base, line)
153
#define SURGSIM_LOG_ONCE_VARIABLE SURGSIM_FLAG_VARIABLE_NAME(surgsimLogOnceFlag, __LINE__)
157
173
#define SURGSIM_LOG_ONCE(logger, level) \
174
static int SURGSIM_LOG_ONCE_VARIABLE = 0; \
175
if ((SURGSIM_LOG_ONCE_VARIABLE++) != 0) \
176
{ \
177
} \
178
else \
179
/* important: no curly braces around this! */
\
180
SURGSIM_LOG(logger, level)
181
182
199
#define SURGSIM_LOG_ONCE_IF(condition, logger, level) \
200
static int SURGSIM_LOG_ONCE_VARIABLE = 0; \
201
if (! (condition)) \
202
{ \
203
} \
204
else if ((SURGSIM_LOG_ONCE_VARIABLE++) != 0) \
205
{ \
206
} \
207
else \
208
/* important: no curly braces around this! */
\
209
SURGSIM_LOG(logger, level)
210
211
213
214
};
// namespace Framework
215
};
// namespace SurgSim
216
217
#endif // SURGSIM_FRAMEWORK_LOGMACROS_H
SurgSim
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition:
AddRandomSphereBehavior.cpp:36
Generated by
1.8.12