Add debug transmitter

This is in preparation to conveniently duplicate debug messages
to Window > Log. For cases where stdout/err is not easily accessible.
This commit is contained in:
Robin Gareus 2020-10-13 21:26:26 +02:00
parent 9ddd83d829
commit 9a4237ba83
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
7 changed files with 22 additions and 7 deletions

View file

@ -30,6 +30,7 @@
#include <boost/tokenizer.hpp>
#include "pbd/debug.h"
#include "pbd/error.h"
#include "pbd/i18n.h"
@ -62,6 +63,7 @@ DebugBits PBD::DEBUG::Threads = PBD::new_debug_bit ("threads");
DebugBits PBD::DEBUG::Locale = PBD::new_debug_bit ("locale");
DebugBits PBD::DEBUG::StringConvert = PBD::new_debug_bit ("stringconvert");
DebugBits PBD::DEBUG::DebugTimestamps = PBD::new_debug_bit ("debugtimestamps");
DebugBits PBD::DEBUG::DebugLogToGUI = PBD::new_debug_bit ("debuglogtogui");
/* These are debug bits that are used by backends. Since these are loaded dynamically,
after command-line parsing, defining them in code that is part of the backend
@ -105,6 +107,10 @@ PBD::debug_print (const char* prefix, string str)
} else {
printf ("%s: %s", prefix, str.c_str());
}
if ((PBD::debug_bits & DEBUG::DebugLogToGUI).any()) {
std::replace (str.begin (), str.end (), '\n', ' ');
debug << prefix << ": " << str << endmsg;
}
}
int