aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-09-18 23:55:25 +0200
committerSven Gothel <[email protected]>2020-09-18 23:55:25 +0200
commitd99b7e79b1bc5e58fd6490d74975639a11a67734 (patch)
treeaeb941bc85391180ce49ab6ddf7a6baed6e58796
parenta9f68522e8d16da2f6aa22a8a3de692261e8930d (diff)
dbt_debug: INFO_PRINT(..) -> WORDY_PRINT(..) cond DBTEnv::VERBOSE, add uncond INFO_PRINT(..)
Turns out INFO_PRINT(..) is confusing, as it was not clear that it is conditional on DBTEnv::VERBOSE. Hence rename it to the short English from for Latin 'verbosus', and hence hinting it is conditional on DBTEnv::VERBOSE. INFO_PRINT(..) renamed to WORDY_PRINT(..), using prefix 'Wordy:' (Verbose is just too long) Add unconditional INFO_PRINT(..) for plain informal messages. Hope this clears up the confusion. Hint: I was looking for an INFO_PRINT(..) ouput myself ;-)
-rw-r--r--api/direct_bt/dbt_debug.hpp12
-rw-r--r--src/direct_bt/dbt_debug.cpp14
2 files changed, 22 insertions, 4 deletions
diff --git a/api/direct_bt/dbt_debug.hpp b/api/direct_bt/dbt_debug.hpp
index 29efc15..7b42e47 100644
--- a/api/direct_bt/dbt_debug.hpp
+++ b/api/direct_bt/dbt_debug.hpp
@@ -46,8 +46,13 @@ namespace direct_bt {
/** Use for environment-variable DBTEnv::DEBUG conditional debug messages, prefix '[elapsed_time] Debug: '. */
void DBG_PRINT(const char * format, ...) noexcept;
- /** Use for environment-variable DBTEnv::VERBOSE conditional info messages, prefix '[elapsed_time] Info: '. */
- void INFO_PRINT(const char * format, ...) noexcept;
+ /**
+ * Use for environment-variable DBTEnv::VERBOSE conditional verbose messages, prefix '[elapsed_time] Wordy: '.
+ * <p>
+ * '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;
#ifdef PERF_PRINT_ON
#define PERF_TS_T0() const uint64_t _t0 = direct_bt::getCurrentMilliseconds()
@@ -77,6 +82,9 @@ namespace direct_bt {
/** Use for unconditional warning messages, prefix '[elapsed_time] Warning @ FILE:LINE: ' */
#define WARN_PRINT(...) { direct_bt::WARN_PRINT2(__FILE__, __LINE__, __VA_ARGS__); }
+ /** Use for unconditional informal messages, prefix '[elapsed_time] Info: '. */
+ void INFO_PRINT(const char * format, ...) noexcept;
+
/** Use for unconditional plain messages, prefix '[elapsed_time] '. */
void PLAIN_PRINT(const char * format, ...) noexcept;
diff --git a/src/direct_bt/dbt_debug.cpp b/src/direct_bt/dbt_debug.cpp
index 62e08cb..cc16d35 100644
--- a/src/direct_bt/dbt_debug.cpp
+++ b/src/direct_bt/dbt_debug.cpp
@@ -41,9 +41,9 @@ void direct_bt::DBG_PRINT(const char * format, ...) noexcept {
}
}
-void direct_bt::INFO_PRINT(const char * format, ...) noexcept {
+void direct_bt::WORDY_PRINT(const char * format, ...) noexcept {
if(direct_bt::DBTEnv::get().VERBOSE) {
- fprintf(stderr, "[%'9" PRIu64 "] Info: ", DBTEnv::getElapsedMillisecond());
+ fprintf(stderr, "[%'9" PRIu64 "] Wordy: ", DBTEnv::getElapsedMillisecond());
va_list args;
va_start (args, format);
vfprintf(stderr, format, args);
@@ -87,6 +87,16 @@ void direct_bt::WARN_PRINT2(const char *file, const int line, const char * forma
fflush(stderr);
}
+void direct_bt::INFO_PRINT(const char * format, ...) noexcept {
+ fprintf(stderr, "[%'9" PRIu64 "] Info: ", DBTEnv::getElapsedMillisecond());
+ va_list args;
+ va_start (args, format);
+ vfprintf(stderr, format, args);
+ va_end (args);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+}
+
void direct_bt::PLAIN_PRINT(const char * format, ...) noexcept {
fprintf(stderr, "[%'9" PRIu64 "] ", DBTEnv::getElapsedMillisecond());
va_list args;