extend PBD::Debug API to provide a method that doesn't send to debug Transmitter

This commit is contained in:
Paul Davis 2023-07-06 16:13:24 -06:00
parent 36ada549b2
commit a59c217205
2 changed files with 9 additions and 1 deletions

View file

@ -100,13 +100,20 @@ PBD::new_debug_bit (const char* name)
} }
void void
PBD::debug_print (const char* prefix, string str) PBD::debug_only_print (const char* prefix, string str)
{ {
if ((PBD::debug_bits & DEBUG::DebugTimestamps).any()) { if ((PBD::debug_bits & DEBUG::DebugTimestamps).any()) {
printf ("%ld %s: %s", g_get_monotonic_time(), prefix, str.c_str()); printf ("%ld %s: %s", g_get_monotonic_time(), prefix, str.c_str());
} else { } else {
printf ("%s: %s", prefix, str.c_str()); printf ("%s: %s", prefix, str.c_str());
} }
}
void
PBD::debug_print (const char* prefix, string str)
{
debug_only_print (prefix, str);
if ((PBD::debug_bits & DEBUG::DebugLogToGUI).any()) { if ((PBD::debug_bits & DEBUG::DebugLogToGUI).any()) {
std::replace (str.begin (), str.end (), '\n', ' '); std::replace (str.begin (), str.end (), '\n', ' ');
debug << prefix << ": " << str << endmsg; debug << prefix << ": " << str << endmsg;

View file

@ -44,6 +44,7 @@ namespace PBD {
LIBPBD_API extern DebugBits debug_bits; LIBPBD_API extern DebugBits debug_bits;
LIBPBD_API DebugBits new_debug_bit (const char* name); LIBPBD_API DebugBits new_debug_bit (const char* name);
LIBPBD_API void debug_print (const char* prefix, std::string str); LIBPBD_API void debug_print (const char* prefix, std::string str);
LIBPBD_API void debug_only_print (const char* prefix, std::string str);
LIBPBD_API void set_debug_bits (DebugBits bits); LIBPBD_API void set_debug_bits (DebugBits bits);
LIBPBD_API int parse_debug_options (const char* str); LIBPBD_API int parse_debug_options (const char* str);
LIBPBD_API void list_debug_options (); LIBPBD_API void list_debug_options ();