48 void dbgPrint1(
const char * format, ...) noexcept;
52 void abortImpl(const
char *func, const
char *file, const
int line, const
char * format, ...) noexcept;
54 void errPrint(const
char *
prefix, const
bool backtrace, const
char *func, const
char *file, const
int line, const
char * format, ...) noexcept;
55 void warnPrint(const
char *func, const
char *file, const
int line, const
char * format, ...) noexcept;
56 void wordyPrint(const
char * format, ...) noexcept;
60 #define ABORT(...) { jau::impl::abortImpl(__func__, __FILE__, __LINE__, __VA_ARGS__); }
63 template <
typename... Args>
64 void dbgPrint(std::string_view format,
const Args &...args) {
72 #define DBG_PRINT(...) { if( jau::environment::get().debug ) { jau::impl::dbgPrint1(__VA_ARGS__); } }
75 #define DBG_WARN_PRINT(...) { if( jau::environment::get().debug ) { jau::impl::warnPrint(__func__, __FILE__, __LINE__, __VA_ARGS__); } }
78 #define DBG_ERR_PRINT(...) { if( jau::environment::get().debug ) { jau::impl::errPrint("Debug", true , __func__, __FILE__, __LINE__, __VA_ARGS__); } }
81 #define DBG_JNI_PRINT(...) { if( jau::environment::get().debug_jni ) { jau::impl::dbgPrint1(__VA_ARGS__); } }
89 #define WORDY_PRINT(...) { if( jau::environment::get().verbose ) { jau::impl::wordyPrint(__VA_ARGS__); } }
92 #define PERF_TS_T0_BASE() const uint64_t _t0 = jau::getCurrentMilliseconds()
94 #define PERF_TS_TD_BASE(m) { const uint64_t _td = jau::getCurrentMilliseconds() - _t0; \
95 fprintf(stderr, "[%s] PERF %s done in %d ms,\n", jau::to_decstring(jau::environment::getElapsedMillisecond(), ',', 9).c_str(), (m), (int)_td); }
97 #define PERF_TS_T0() PERF_TS_T0_BASE()
98 #define PERF_TS_TD(m) PERF_TS_TD_BASE(m)
101 #define PERF_TS_TD(m)
103 #ifdef PERF2_PRINT_ON
104 #define PERF2_TS_T0() PERF_TS_T0_BASE()
105 #define PERF2_TS_TD(m) PERF_TS_TD_BASE(m)
107 #define PERF2_TS_T0()
108 #define PERF2_TS_TD(m)
110 #ifdef PERF3_PRINT_ON
111 #define PERF3_TS_T0() PERF_TS_T0_BASE()
112 #define PERF3_TS_TD(m) PERF_TS_TD_BASE(m)
114 #define PERF3_TS_T0()
115 #define PERF3_TS_TD(m)
119 void ERR_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
122 #define ERR_PRINT(...) { jau::impl::errPrint("Error", true , __func__, __FILE__, __LINE__, __VA_ARGS__); }
125 #define ERR_PRINT2(...) { jau::impl::errPrint("Error", false , __func__, __FILE__, __LINE__, __VA_ARGS__); }
128 #define IRQ_PRINT(...) { jau::impl::errPrint("Interrupted", false , __func__, __FILE__, __LINE__, __VA_ARGS__); }
131 void WARN_PRINTv(
const char *func,
const char *file,
const int line,
const char * format, va_list args)
noexcept;
134 #define WARN_PRINT(...) { jau::impl::warnPrint(__func__, __FILE__, __LINE__, __VA_ARGS__); }
137 void INFO_PRINT(
const char * format, ...) noexcept;
140 void PLAIN_PRINT(const
bool printPrefix, const
char * format, ...) noexcept;
149 int fprintf_td(const uint64_t elapsed_ms, FILE* stream, const
char * format, ...) noexcept;
157 int fprintf_td(FILE* stream, const
char * format, ...) noexcept;
162 #define COND_PRINT(C, ...) { if( C ) { jau::COND_PRINT_impl(__VA_ARGS__); } }
167 fprintf(stderr,
"%s: Start: %zu elements\n",
prefix.c_str(), (
size_t)list.size());
169 for (
auto it = list.begin(); it != list.end(); idx++) {
170 typename List::value_type & e = *it;
171 if (
nullptr != e ) {
172 fprintf(stderr,
"%s[%d]: useCount %zu, mem %p\n",
prefix.c_str(), idx, (
size_t)e.use_count(), e.get());
174 fprintf(stderr,
"%s[%d]: NULL\n",
prefix.c_str(), idx);
constexpr PResult checkR2(const std::string_view fmt) noexcept
Strict type validation of arguments against the format string.
void abortImpl(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 wordyPrint(const char *format,...) noexcept
void dbgPrint1(const char *format,...) noexcept
void dbgPrint2(const char *s) noexcept
void errPrint(const char *prefix, const bool backtrace, const char *func, const char *file, const int line, const char *format,...) noexcept
constexpr std::string format_string_h(const std::size_t strLenHint, const std::string_view format, const Args &...args)
void warnPrint(const char *func, const char *file, const int line, const char *format,...) noexcept
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
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 dbgPrint(std::string_view format, const Args &...args)
Use for environment-variable environment::DEBUG conditional debug messages, prefix '[elapsed_time] De...
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 COND_PRINT_impl(const char *format,...) noexcept
void printSharedPtrList(const std::string &prefix, List &list) noexcept
constexpr ssize_t argCount() const noexcept
std::string toString() const