YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
LogComponent.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_OS_LOGCOMPONENT_H
7#define YARP_OS_LOGCOMPONENT_H
8
9#include <yarp/os/api.h>
10#include <yarp/os/Log.h>
11
12#include <atomic>
13
14namespace yarp::os {
15
17{
18public:
21
22 LogComponent(const char* name,
23 LogType minimumPrintLevel = yarp::os::Log::minimumPrintLevel(),
24 LogType minimumForwardLevel = yarp::os::Log::minimumForwardLevel(),
27
28 LogComponent(const LogComponent&) = delete;
32
34
35 LogCallback printCallback(yarp::os::Log::LogType t) const;
36 LogCallback forwardCallback(yarp::os::Log::LogType t) const;
37
38 constexpr const char* name() const { return m_name; }
39 constexpr operator bool() const { return m_name != nullptr; }
40
41#ifndef DOXYGEN_SHOULD_SKIP_THIS
42
43#ifndef YARP_NO_DEPRECATED // Since YARP 3.4
44 // These methods are currently used to support setVerbose and setQuiet
45 // around the code, they should not be used in new code
46 void setMinimumPrintLevel(LogType minimumPrintLevel);
47 void setMinimumForwardLevel(LogType minimumForwardLevel);
48#endif // YARP_NO_DEPRECATED
49
50private:
51 const char* m_name { nullptr };
52
53 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_tracePrintEnabled;
54 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_debugPrintEnabled;
55 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_infoPrintEnabled;
56 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_warningPrintEnabled;
57 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_errorPrintEnabled;
58 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_fatalPrintEnabled;
59 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_traceForwardEnabled;
60 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_debugForwardEnabled;
61 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_infoForwardEnabled;
62 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_warningForwardEnabled;
63 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_errorForwardEnabled;
64 YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(std::atomic<bool>) m_fatalForwardEnabled;
65
66 LogCallback m_printCallback { nullptr };
67 LogCallback m_forwardCallback { nullptr };
68
69#endif // DOXYGEN_SHOULD_SKIP_THIS
70
71};
72
73#define YARP_DECLARE_LOG_COMPONENT(name) \
74 extern const yarp::os::LogComponent& name();
75
76#define YARP_LOG_COMPONENT(name, ...) \
77 const yarp::os::LogComponent& name() \
78 { \
79 static const yarp::os::LogComponent component(__VA_ARGS__); \
80 return component; \
81 }
82
83#ifndef NDEBUG
84# define yCTrace(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", nullptr, (component)()).trace(__VA_ARGS__)
85# define yCTraceOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_ONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
86# define yCTraceThreadOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
87# define yCTraceThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
88# define yCTraceThreadThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADTHROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
89# define yCTraceExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, nullptr, (component)()).trace(__VA_ARGS__)
90# define yCTraceExternalTimeOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_ONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
91# define yCTraceExternalTimeThreadOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
92# define yCTraceExternalTimeThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
93# define yCTraceExternalTimeThreadThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
94# define yCITrace(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).trace(__VA_ARGS__)
95# define yCITraceOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_ONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
96# define yCITraceThreadOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
97# define yCITraceThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
98# define yCITraceThreadThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
99# define yCITraceExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).trace(__VA_ARGS__)
100# define yCITraceExternalTimeOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_ONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
101# define yCITraceExternalTimeThreadOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADONCE_CALLBACK, (component)()).trace(__VA_ARGS__)
102# define yCITraceExternalTimeThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
103# define yCITraceExternalTimeThreadThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).trace(__VA_ARGS__)
104#else
105# define yCTrace(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
106# define yCTraceOnce(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
107# define yCTraceThreadOnce(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
108# define yCTraceThrottle(component, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
109# define yCTraceThreadThrottle(component, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
110# define yCTraceExternalTime(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
111# define yCTraceExternalTimeOnce(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
112# define yCTraceExternalTimeThreadOnce(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
113# define yCTraceExternalTimeThrottle(component, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
114# define yCTraceExternalTimeThreadThrottle(component, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
115# define yCITrace(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
116# define yCITraceOnce(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
117# define yCITraceThreadOnce(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
118# define yCITraceThrottle(component, id, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
119# define yCITraceThreadThrottle(component, id, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
120# define yCITraceExternalTime(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
121# define yCITraceExternalTimeOnce(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
122# define yCITraceExternalTimeThreadOnce(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
123# define yCITraceExternalTimeThrottle(component, id, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
124# define yCITraceExternalTimeThreadThrottle(component, id, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
125#endif
126
127#ifndef YARP_NO_DEBUG_OUTPUT
128# define yCDebug(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", nullptr, (component)()).debug(__VA_ARGS__)
129# define yCDebugOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_ONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
130# define yCDebugThreadOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
131# define yCDebugThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
132# define yCDebugThreadThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADTHROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
133# define yCDebugExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, nullptr, (component)()).debug(__VA_ARGS__)
134# define yCDebugExternalTimeOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_ONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
135# define yCDebugExternalTimeThreadOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
136# define yCDebugExternalTimeThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
137# define yCDebugExternalTimeThreadThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
138# define yCIDebug(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).debug(__VA_ARGS__)
139# define yCIDebugOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_ONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
140# define yCIDebugThreadOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
141# define yCIDebugThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
142# define yCIDebugThreadThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
143# define yCIDebugExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).debug(__VA_ARGS__)
144# define yCIDebugExternalTimeOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_ONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
145# define yCIDebugExternalTimeThreadOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADONCE_CALLBACK, (component)()).debug(__VA_ARGS__)
146# define yCIDebugExternalTimeThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
147# define yCIDebugExternalTimeThreadThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).debug(__VA_ARGS__)
148#else
149# define yCDebug(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
150# define yCDebugOnce(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
151# define yCDebugThreadOnce(component, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
152# define yCDebugThrottle(component, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
153# define yCDebugThreadThrottle(component, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
154# define yCDebugExternalTime(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
155# define yCDebugExternalTimeOnce(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
156# define yCDebugExternalTimeThreadOnce(component, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
157# define yCDebugExternalTimeThrottle(component, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
158# define yCDebugExternalTimeThreadThrottle(component, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
159# define yCIDebug(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
160# define yCIDebugOnce(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
161# define yCIDebugThreadOnce(component, id, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
162# define yCIDebugThrottle(component, id, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
163# define yCIDebugThreadThrottle(component, id, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
164# define yCIDebugExternalTime(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
165# define yCIDebugExternalTimeOnce(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
166# define yCIDebugExternalTimeThreadOnce(component, id, externaltime, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
167# define yCIDebugExternalTimeThrottle(component, id, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
168# define yCIDebugExternalTimeThreadThrottle(component, id, externaltime, period, ...) YARP_UNUSED((component)()); yarp::os::Log::nolog(__VA_ARGS__)
169#endif
170
171#define yCInfo(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", nullptr, (component)()).info(__VA_ARGS__)
172#define yCInfoOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_ONCE_CALLBACK, (component)()).info(__VA_ARGS__)
173#define yCInfoThreadOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADONCE_CALLBACK, (component)()).info(__VA_ARGS__)
174#define yCInfoThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
175#define yCInfoThreadThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADTHROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
176#define yCInfoExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, nullptr, (component)()).info(__VA_ARGS__)
177#define yCInfoExternalTimeOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_ONCE_CALLBACK, (component)()).info(__VA_ARGS__)
178#define yCInfoExternalTimeThreadOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADONCE_CALLBACK, (component)()).info(__VA_ARGS__)
179#define yCInfoExternalTimeThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
180#define yCInfoExternalTimeThreadThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
181#define yCIInfo(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).info(__VA_ARGS__)
182#define yCIInfoOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_ONCE_CALLBACK, (component)()).info(__VA_ARGS__)
183#define yCIInfoThreadOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADONCE_CALLBACK, (component)()).info(__VA_ARGS__)
184#define yCIInfoThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
185#define yCIInfoThreadThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
186#define yCIInfoExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).info(__VA_ARGS__)
187#define yCIInfoExternalTimeOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_ONCE_CALLBACK, (component)()).info(__VA_ARGS__)
188#define yCIInfoExternalTimeThreadOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADONCE_CALLBACK, (component)()).info(__VA_ARGS__)
189#define yCIInfoExternalTimeThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
190#define yCIInfoExternalTimeThreadThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).info(__VA_ARGS__)
191
192#define yCWarning(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", nullptr, (component)()).warning(__VA_ARGS__)
193#define yCWarningOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_ONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
194#define yCWarningThreadOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
195#define yCWarningThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
196#define yCWarningThreadThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADTHROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
197#define yCWarningExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, nullptr, (component)()).warning(__VA_ARGS__)
198#define yCWarningExternalTimeOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_ONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
199#define yCWarningExternalTimeThreadOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
200#define yCWarningExternalTimeThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
201#define yCWarningExternalTimeThreadThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
202#define yCIWarning(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).warning(__VA_ARGS__)
203#define yCIWarningOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_ONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
204#define yCIWarningThreadOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
205#define yCIWarningThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
206#define yCIWarningThreadThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
207#define yCIWarningExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).warning(__VA_ARGS__)
208#define yCIWarningExternalTimeOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_ONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
209#define yCIWarningExternalTimeThreadOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADONCE_CALLBACK, (component)()).warning(__VA_ARGS__)
210#define yCIWarningExternalTimeThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
211#define yCIWarningExternalTimeThreadThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).warning(__VA_ARGS__)
212
213#define yCError(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", nullptr, (component)()).error(__VA_ARGS__)
214#define yCErrorOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_ONCE_CALLBACK, (component)()).error(__VA_ARGS__)
215#define yCErrorThreadOnce(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADONCE_CALLBACK, (component)()).error(__VA_ARGS__)
216#define yCErrorThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
217#define yCErrorThreadThrottle(component, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", YARP_THREADTHROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
218#define yCErrorExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, nullptr, (component)()).error(__VA_ARGS__)
219#define yCErrorExternalTimeOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_ONCE_CALLBACK, (component)()).error(__VA_ARGS__)
220#define yCErrorExternalTimeThreadOnce(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADONCE_CALLBACK, (component)()).error(__VA_ARGS__)
221#define yCErrorExternalTimeThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
222#define yCErrorExternalTimeThreadThrottle(component, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, "", externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
223#define yCIError(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).error(__VA_ARGS__)
224#define yCIErrorOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_ONCE_CALLBACK, (component)()).error(__VA_ARGS__)
225#define yCIErrorThreadOnce(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADONCE_CALLBACK, (component)()).error(__VA_ARGS__)
226#define yCIErrorThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
227#define yCIErrorThreadThrottle(component, id, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
228#define yCIErrorExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).error(__VA_ARGS__)
229#define yCIErrorExternalTimeOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_ONCE_CALLBACK, (component)()).error(__VA_ARGS__)
230#define yCIErrorExternalTimeThreadOnce(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADONCE_CALLBACK, (component)()).error(__VA_ARGS__)
231#define yCIErrorExternalTimeThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
232#define yCIErrorExternalTimeThreadThrottle(component, id, externaltime, period, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, YARP_THREADTHROTTLE_CALLBACK(period), (component)()).error(__VA_ARGS__)
233
234#define yCFatal(component, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, nullptr, (component)()).fatal(__VA_ARGS__)
235#define yCFatalExternalTime(component, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, externaltime, nullptr, (component)()).fatal(__VA_ARGS__)
236#define yCIFatal(component, id, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, nullptr, (component)()).fatal(__VA_ARGS__)
237#define yCIFatalExternalTime(component, id, externaltime, ...) yarp::os::Log(__FILE__, __LINE__, __YFUNCTION__, id, externaltime, nullptr, (component)()).fatal(__VA_ARGS__)
238
239#ifndef NDEBUG
240# define yCAssert(component, x) \
241 if (!(x)) { \
242 yCFatal(component, "Assertion failure at %s:%d (%s)", __FILE__, __LINE__, #x); \
243 }
244# define yCAssertExternalTime(component, externaltime, x) \
245 if (!(x)) { \
246 yCFatalExternalTime(component, externaltime, "Assertion failure at %s:%d (%s)", __FILE__, __LINE__, #x); \
247 }
248# define yCIAssert(component, id, x) \
249 if (!(x)) { \
250 yCIFatal(component, id, "Assertion failure at %s:%d (%s)", __FILE__, __LINE__, #x); \
251 }
252# define yCIAssertExternalTime(component, id, externaltime, x) \
253 if (!(x)) { \
254 yCIFatalExternalTime(component, id, externaltime, "Assertion failure at %s:%d (%s)", __FILE__, __LINE__, #x); \
255 }
256#else
257# define yCAssert(component, x) { YARP_UNUSED((component)()); }
258# define yCAssertExternalTime(component, externaltime, x) { YARP_UNUSED((component)()); YARP_UNUSED(externaltime); }
259# define yCIAssert(component, id, x) { YARP_UNUSED((component)()); YARP_UNUSED(id); }
260# define yCIAssertExternalTime(component, id, externaltime, x) { YARP_UNUSED((component)()); YARP_UNUSED(id); YARP_UNUSED(externaltime); }
261#endif
262
263
264} // namespace yarp::os
265
266#endif // YARP_OS_LOGCOMPONENT_H
float t
A mini-server for performing network communication in the background.
LogComponent(LogComponent &&) noexcept=delete
LogComponent(const LogComponent &)=delete
yarp::os::Log::LogCallback LogCallback
static LogCallback printCallback()
Get current print callback.
Definition Log.cpp:873
static LogType minimumPrintLevel()
Get current minimum print level.
Definition Log.cpp:833
static LogCallback forwardCallback()
Get current forward callback (or nullptr if forwarding is not enabled)
Definition Log.cpp:895
static LogType minimumForwardLevel()
Get current minimum forward level (or LogTypeReserved if forwarding is not enabled)
Definition Log.cpp:853
void(*)(yarp::os::Log::LogType type, const char *msg, const char *file, const unsigned int line, const char *func, double systemtime, double networktime, double externaltime, const char *comp_name, const char *id) LogCallback
Definition Log.h:130
yarp::os::Log::LogCallback LogCallback
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition system.h:338
#define YARP_os_API
Definition api.h:18