File tree Expand file tree Collapse file tree 1 file changed +6
-43
lines changed Expand file tree Collapse file tree 1 file changed +6
-43
lines changed Original file line number Diff line number Diff line change 1919namespace ada {
2020
2121/* *
22- * Private function used for logging messages.
22+ * Log a message. If you want to have no overhead when logging is disabled, use
23+ * the ada_log macro.
2324 * @private
2425 */
25- template <typename T >
26- ada_really_inline void inner_log ([[maybe_unused]] T t ) {
26+ template <typename ... Args >
27+ constexpr ada_really_inline void log ([[maybe_unused]] Args... args ) {
2728#if ADA_LOGGING
28- std::cout << t << std::endl;
29- #endif
30- }
31-
32- /* *
33- * Private function used for logging messages.
34- * @private
35- */
36- template <typename T, typename ... Args>
37- ada_really_inline void inner_log ([[maybe_unused]] T t,
38- [[maybe_unused]] Args... args) {
39- #if ADA_LOGGING
40- std::cout << t;
41- inner_log (args...);
42- #endif
43- }
44-
45- /* *
46- * Log a message.
47- * @private
48- */
49- template <typename T, typename ... Args>
50- ada_really_inline void log ([[maybe_unused]] T t,
51- [[maybe_unused]] Args... args) {
52- #if ADA_LOGGING
53- std::cout << " ADA_LOG: " << t;
54- inner_log (args...);
55- #endif
56- }
57-
58- /* *
59- * Log a message.
60- * @private
61- */
62- template <typename T>
63- ada_really_inline void log ([[maybe_unused]] T t) {
64- #if ADA_LOGGING
65- std::cout << " ADA_LOG: " << t << std::endl;
66- #endif
29+ ((std::cout << " ADA_LOG: " ) << ... << args) << std::endl;
30+ #endif // ADA_LOGGING
6731}
6832} // namespace ada
6933
7034#if ADA_LOGGING
71-
7235#ifndef ada_log
7336#define ada_log (...) \
7437 do { \
You can’t perform that action at this time.
0 commit comments