52 #define DBG_PRINT(...) { if( jau::environment::get().debug ) { jau::DBG_PRINT_impl(__VA_ARGS__); } }
55 #define DBG_WARN_PRINT(...) { if( jau::environment::get().debug ) { jau::WARN_PRINT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); } }
58 #define DBG_ERR_PRINT(...) { if( jau::environment::get().debug ) { jau::ERR_PRINT_impl("Debug", true , __func__, __FILE__, __LINE__, __VA_ARGS__); } }
61 #define DBG_JNI_PRINT(...) { if( jau::environment::get().debug_jni ) { jau::DBG_PRINT_impl(__VA_ARGS__); } }
71 #define WORDY_PRINT(...) { if( jau::environment::get().verbose ) { jau::WORDY_PRINT_impl(__VA_ARGS__); } }
74 #define PERF_TS_T0_BASE() const uint64_t _t0 = jau::getCurrentMilliseconds()
76 #define PERF_TS_TD_BASE(m) { const uint64_t _td = jau::getCurrentMilliseconds() - _t0; \
77 fprintf(stderr, "[%s] PERF %s done in %d ms,\n", jau::to_decstring(jau::environment::getElapsedMillisecond(), ',', 9).c_str(), (m), (int)_td); }
79 #define PERF_TS_T0() PERF_TS_T0_BASE()
80 #define PERF_TS_TD(m) PERF_TS_TD_BASE(m)
86 #define PERF2_TS_T0() PERF_TS_T0_BASE()
87 #define PERF2_TS_TD(m) PERF_TS_TD_BASE(m)
90 #define PERF2_TS_TD(m)
93 #define PERF3_TS_T0() PERF_TS_T0_BASE()
94 #define PERF3_TS_TD(m) PERF_TS_TD_BASE(m)
97 #define PERF3_TS_TD(m)
101 void ABORT_impl(
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
104 #define ABORT(...) { jau::ABORT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); }
107 void ERR_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
109 void ERR_PRINT_impl(
const char *prefix,
const bool backtrace,
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
112 #define ERR_PRINT(...) { jau::ERR_PRINT_impl("Error", true , __func__, __FILE__, __LINE__, __VA_ARGS__); }
115 #define ERR_PRINT2(...) { jau::ERR_PRINT_impl("Error", false , __func__, __FILE__, __LINE__, __VA_ARGS__); }
118 #define IRQ_PRINT(...) { jau::ERR_PRINT_impl("Interrupted", false , __func__, __FILE__, __LINE__, __VA_ARGS__); }
121 void WARN_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
123 void WARN_PRINT_impl(
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
126 #define WARN_PRINT(...) { jau::WARN_PRINT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); }
129 void INFO_PRINT(
const char * format, ...) noexcept;
132 void PLAIN_PRINT(const
bool printPrefix, const
char * format, ...) noexcept;
141 int fprintf_td(const uint64_t elapsed_ms, FILE* stream, const
char * format, ...) noexcept;
149 int fprintf_td(FILE* stream, const
char * format, ...) noexcept;
154 #define COND_PRINT(C, ...) { if( C ) { jau::COND_PRINT_impl(__VA_ARGS__); } }
159 fprintf(stderr,
"%s: Start: %zu elements\n", prefix.c_str(), (
size_t)list.size());
161 for (
auto it = list.begin(); it != list.end(); idx++) {
162 typename List::value_type & e = *it;
163 if (
nullptr != e ) {
164 fprintf(stderr,
"%s[%d]: useCount %zu, mem %p\n", prefix.c_str(), idx, (
size_t)e.use_count(), e.get());
166 fprintf(stderr,
"%s[%d]: NULL\n", prefix.c_str(), idx);
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
void ABORT_impl(const char *func, const char *file, const int line, const char *format,...) noexcept
Use for unconditional ::abort() call with given messages, prefix '[elapsed_time] ABORT @ file:line fu...
void PLAIN_PRINT(const bool printPrefix, const char *format,...) noexcept
Use for unconditional plain messages, prefix '[elapsed_time] ' if printPrefix == true.
void ERR_PRINTv(const char *func, const char *file, const int line, const char *format, va_list args) noexcept
Use for unconditional error messages, prefix '[elapsed_time] Error @ file:line func: '.
void INFO_PRINT(const char *format,...) noexcept
Use for unconditional informal messages, prefix '[elapsed_time] Info: '.
int fprintf_td(const uint64_t elapsed_ms, FILE *stream, const char *format,...) noexcept
Convenient fprintf() invocation, prepending the given elapsed_ms timestamp.
void WARN_PRINTv(const char *func, const char *file, const int line, const char *format, va_list args) noexcept
Use for unconditional warning messages, prefix '[elapsed_time] Warning @ file:line func: '.
void DBG_PRINT_impl(const char *format,...) noexcept
void ERR_PRINT_impl(const char *prefix, const bool backtrace, const char *func, const char *file, const int line, const char *format,...) noexcept
void COND_PRINT_impl(const char *format,...) noexcept
void WORDY_PRINT_impl(const char *format,...) noexcept
void WARN_PRINT_impl(const char *func, const char *file, const int line, const char *format,...) noexcept
void printSharedPtrList(const std::string &prefix, List &list) noexcept