aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/direct_bt/dbt_debug.hpp19
-rw-r--r--java/jni/JNIMem.cxx7
-rw-r--r--src/direct_bt/dbt_debug.cpp40
3 files changed, 31 insertions, 35 deletions
diff --git a/api/direct_bt/dbt_debug.hpp b/api/direct_bt/dbt_debug.hpp
index 057c489..f6b360b 100644
--- a/api/direct_bt/dbt_debug.hpp
+++ b/api/direct_bt/dbt_debug.hpp
@@ -43,8 +43,13 @@ extern "C" {
namespace direct_bt {
+ void DBG_PRINT_impl(const char * format, ...) noexcept;
+
/** Use for environment-variable DBTEnv::DEBUG conditional debug messages, prefix '[elapsed_time] Debug: '. */
- void DBG_PRINT(const char * format, ...) noexcept;
+ #define DBG_PRINT(...) { if( direct_bt::DBTEnv::get().DEBUG ) { direct_bt::DBG_PRINT_impl(__VA_ARGS__); } }
+
+
+ void WORDY_PRINT_impl(const char * format, ...) noexcept;
/**
* Use for environment-variable DBTEnv::VERBOSE conditional verbose messages, prefix '[elapsed_time] Wordy: '.
@@ -52,7 +57,8 @@ namespace direct_bt {
* 'Wordy' is the shorter English form of the Latin word 'verbosus', from which the word 'verbosity' is sourced.
* </p>
*/
- void WORDY_PRINT(const char * format, ...) noexcept;
+ #define WORDY_PRINT(...) { if( direct_bt::DBTEnv::get().VERBOSE ) { direct_bt::WORDY_PRINT_impl(__VA_ARGS__); } }
+
#define PERF_TS_T0_BASE() const uint64_t _t0 = direct_bt::getCurrentMilliseconds()
@@ -89,7 +95,6 @@ namespace direct_bt {
/** Use for unconditional error messages, prefix '[elapsed_time] Error @ file:line: '. Function also appends last errno and strerror(errno). */
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] 'prefix' @ file:line: '. Function also appends last errno and strerror(errno). */
void ERR_PRINT_impl(const char *func, const char *prefix, const char *file, const int line, const char * format, ...) noexcept;
/** Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE: '. Function also appends last errno and strerror(errno). */
@@ -101,7 +106,6 @@ namespace direct_bt {
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ file:line: ' */
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: ' */
void WARN_PRINT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept;
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ FILE:LINE: ' */
@@ -113,11 +117,12 @@ namespace direct_bt {
/** Use for unconditional plain messages, prefix '[elapsed_time] '. */
void PLAIN_PRINT(const char * format, ...) noexcept;
- /** Use for conditional plain messages, prefix '[elapsed_time] '. */
- void COND_PRINT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept;
+
+ void COND_PRINT_impl(const char * format, ...) noexcept;
/** Use for conditional plain messages, prefix '[elapsed_time] '. */
- #define COND_PRINT(C, ...) { if(C) { COND_PRINT_impl(__func__, __FILE__, __LINE__, __VA_ARGS__); } }
+ #define COND_PRINT(C, ...) { if( C ) { direct_bt::COND_PRINT_impl(__VA_ARGS__); } }
+
template<class ListElemType>
inline void printSharedPtrList(std::string prefix, std::vector<std::shared_ptr<ListElemType>> & list) noexcept {
diff --git a/java/jni/JNIMem.cxx b/java/jni/JNIMem.cxx
index 19a63bd..2edbf98 100644
--- a/java/jni/JNIMem.cxx
+++ b/java/jni/JNIMem.cxx
@@ -29,14 +29,9 @@
#include <cstdio>
#include "JNIMem.hpp"
+
#include "dbt_debug.hpp"
-// #define VERBOSE_ON 1
-#ifdef VERBOSE_ON
- #define DBG_PRINT(...) { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
-#else
- #define DBG_PRINT(...)
-#endif
JavaVM* vm;
thread_local JNIEnvContainer jni_env;
diff --git a/src/direct_bt/dbt_debug.cpp b/src/direct_bt/dbt_debug.cpp
index fe536f9..fb09d33 100644
--- a/src/direct_bt/dbt_debug.cpp
+++ b/src/direct_bt/dbt_debug.cpp
@@ -29,28 +29,24 @@
using namespace direct_bt;
-void direct_bt::DBG_PRINT(const char * format, ...) noexcept {
- if(direct_bt::DBTEnv::get().DEBUG) {
- fprintf(stderr, "[%'9" PRIu64 "] Debug: ", DBTEnv::getElapsedMillisecond());
- va_list args;
- va_start (args, format);
- vfprintf(stderr, format, args);
- va_end (args);
- fprintf(stderr, "\n");
- fflush(stderr);
- }
+void direct_bt::DBG_PRINT_impl(const char * format, ...) noexcept {
+ fprintf(stderr, "[%'9" PRIu64 "] Debug: ", DBTEnv::getElapsedMillisecond());
+ va_list args;
+ va_start (args, format);
+ vfprintf(stderr, format, args);
+ va_end (args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
}
-void direct_bt::WORDY_PRINT(const char * format, ...) noexcept {
- if(direct_bt::DBTEnv::get().VERBOSE) {
- fprintf(stderr, "[%'9" PRIu64 "] Wordy: ", DBTEnv::getElapsedMillisecond());
- va_list args;
- va_start (args, format);
- vfprintf(stderr, format, args);
- va_end (args);
- fprintf(stderr, "\n");
- fflush(stderr);
- }
+void direct_bt::WORDY_PRINT_impl(const char * format, ...) noexcept {
+ fprintf(stderr, "[%'9" PRIu64 "] Wordy: ", DBTEnv::getElapsedMillisecond());
+ va_list args;
+ va_start (args, format);
+ vfprintf(stderr, format, args);
+ va_end (args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
}
void direct_bt::ABORT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept {
@@ -118,12 +114,12 @@ void direct_bt::PLAIN_PRINT(const char * format, ...) noexcept {
fflush(stderr);
}
-void direct_bt::COND_PRINT_impl(const char *func, const char *file, const int line, const char * format, ...) noexcept {
+void direct_bt::COND_PRINT_impl(const char * format, ...) noexcept {
fprintf(stderr, "[%'9" PRIu64 "] ", DBTEnv::getElapsedMillisecond());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
va_end (args);
- fprintf(stderr, " @ %s:%d %s\n", file, line, func);
+ fprintf(stderr, "\n");
fflush(stderr);
}