DART 6.13.2
Loading...
Searching...
No Matches
Logging.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2022, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_COMMON_LOGGING_HPP_
34#define DART_COMMON_LOGGING_HPP_
35
36// clang-format off
37#define DART_LOG_LEVEL_TRACE 0
38#define DART_LOG_LEVEL_DEBUG 1
39#define DART_LOG_LEVEL_INFO 2
40#define DART_LOG_LEVEL_WARN 3
41#define DART_LOG_LEVEL_ERROR 4
42#define DART_LOG_LEVEL_FATAL 5
43#define DART_LOG_LEVEL_OFF 6
44// clang-format on
45
46// Default active log level
47#if !defined(DART_ACTIVE_LOG_LEVEL)
48 #define DART_ACTIVE_LOG_LEVEL DART_LOG_LEVEL_INFO
49#endif
50
51#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_TRACE
52 #define DART_TRACE(...) ::dart::common::trace(__VA_ARGS__)
53#else
54 #define DART_TRACE(...) (void)0
55#endif
56
57#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_DEBUG
58 #define DART_DEBUG(...) ::dart::common::debug(__VA_ARGS__)
59#else
60 #define DART_DEBUG(...) (void)0
61#endif
62
63#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_INFO
64 #define DART_INFO(...) ::dart::common::info(__VA_ARGS__)
65#else
66 #define DART_INFO(...) (void)0
67#endif
68
69#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_WARN
70 #define DART_WARN(...) ::dart::common::warn(__VA_ARGS__)
71#else
72 #define DART_WARN(...) (void)0
73#endif
74
75#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_ERROR
76 #define DART_ERROR(...) ::dart::common::error(__VA_ARGS__)
77#else
78 #define DART_ERROR(...) (void)0
79#endif
80
81#if DART_ACTIVE_LOG_LEVEL <= DART_LOG_LEVEL_FATAL
82 #define DART_FATAL(...) ::dart::common::fatal(__VA_ARGS__)
83#else
84 #define DART_FATAL(...) (void)0
85#endif
86
87namespace dart::common {
88
94template <typename S, typename... Args>
95void trace(const S& format_str, Args&&... args);
96
102template <typename S, typename... Args>
103void debug(const S& format_str, Args&&... args);
104
113template <typename S, typename... Args>
114void info(const S& format_str, Args&&... args);
115
121template <typename S, typename... Args>
122void warn(const S& format_str, Args&&... args);
123
130template <typename S, typename... Args>
131void error(const S& format_str, Args&&... args);
132
139template <typename S, typename... Args>
140void fatal(const S& format_str, Args&&... args);
141
142} // namespace dart::common
143
145
146#endif // DART_COMMON_LOGGING_HPP_
Definition Aspect.cpp:42
void fatal(const S &format_str, Args &&... args)
Logs for a fatal error message.
Definition Logging-impl.hpp:140
void info(const S &format_str, Args &&... args)
Logs for a information message.
Definition Logging-impl.hpp:104
void warn(const S &format_str, Args &&... args)
Logs for a warning message.
Definition Logging-impl.hpp:116
void trace(const S &format_str, Args &&... args)
Logs for a trace message.
Definition Logging-impl.hpp:80
void error(const S &format_str, Args &&... args)
Logs for a error message.
Definition Logging-impl.hpp:128
const bool debug
Definition urdf_world_parser.cpp:49