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_JNI_PRINT(...) { if( jau::environment::get().debug_jni ) { jau::DBG_PRINT_impl(__VA_ARGS__); } }
68 #define WORDY_PRINT(...) { if( jau::environment::get().verbose ) { jau::WORDY_PRINT_impl(__VA_ARGS__); } }
71 #define PERF_TS_T0_BASE() const uint64_t _t0 = jau::getCurrentMilliseconds()
73 #define PERF_TS_TD_BASE(m) { const uint64_t _td = jau::getCurrentMilliseconds() - _t0; \
74 fprintf(stderr, "[%s] PERF %s done in %d ms,\n", jau::to_decstring(jau::environment::getElapsedMillisecond(), ',', 9).c_str(), (m), (int)_td); }
76 #define PERF_TS_T0() PERF_TS_T0_BASE()
77 #define PERF_TS_TD(m) PERF_TS_TD_BASE(m)
83 #define PERF2_TS_T0() PERF_TS_T0_BASE()
84 #define PERF2_TS_TD(m) PERF_TS_TD_BASE(m)
87 #define PERF2_TS_TD(m)
90 #define PERF3_TS_T0() PERF_TS_T0_BASE()
91 #define PERF3_TS_TD(m) PERF_TS_TD_BASE(m)
94 #define PERF3_TS_TD(m)
98 void ABORT_impl(
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
101 #define ABORT(...) { jau::ABORT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); }
104 void ERR_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
106 void ERR_PRINT_impl(
const char *prefix,
const bool backtrace,
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
109 #define ERR_PRINT(...) { jau::ERR_PRINT_impl("Error", true
, __func__, __FILE__, __LINE__, __VA_ARGS__); }
112 #define ERR_PRINT2(...) { jau::ERR_PRINT_impl("Error", false
, __func__, __FILE__, __LINE__, __VA_ARGS__); }
115 #define IRQ_PRINT(...) { jau::ERR_PRINT_impl("Interrupted", false
, __func__, __FILE__, __LINE__, __VA_ARGS__); }
118 void WARN_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
120 void WARN_PRINT_impl(
const char *func,
const char *file,
const int line,
const char * format, ...) noexcept;
123 #define WARN_PRINT(...) { jau::WARN_PRINT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); }
126 void INFO_PRINT(
const char * format, ...) noexcept;
129 void PLAIN_PRINT(const
bool printPrefix, const
char * format, ...) noexcept;
138 int fprintf_td(const uint64_t elapsed_ms, FILE* stream, const
char * format, ...) noexcept;
146 int fprintf_td(FILE* stream, const
char * format, ...) noexcept;
151 #define COND_PRINT(C, ...) { if( C ) { jau::COND_PRINT_impl(__VA_ARGS__); } }
156 fprintf(stderr,
"%s: Start: %zu elements\n", prefix.c_str(), (
size_t)list.size());
158 for (
auto it = list.begin(); it != list.end(); idx++) {
159 typename List::value_type & e = *it;
160 if (
nullptr != e ) {
161 fprintf(stderr,
"%s[%d]: useCount %zu, mem %p\n", prefix.c_str(), idx, (
size_t)e.use_count(), e.get());
163 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