13
0

add new debug bit (DebugTimestamps) that adds timestamps to all debug messages

This commit is contained in:
Paul Davis 2019-10-28 16:52:18 -06:00
parent 4073e7573d
commit 43eb64d23b
2 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,7 @@ DebugBits PBD::DEBUG::Timing = PBD::new_debug_bit ("timing");
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");
/* 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
@ -98,6 +99,9 @@ PBD::new_debug_bit (const char* name)
void
PBD::debug_print (const char* prefix, string str)
{
if ((PBD::debug_bits & DEBUG::DebugTimestamps).any()) {
cout << g_get_monotonic_time() << ' ';
}
cout << prefix << ": " << str;
}

View File

@ -62,6 +62,7 @@ namespace PBD {
LIBPBD_API extern DebugBits Threads;
LIBPBD_API extern DebugBits Locale;
LIBPBD_API extern DebugBits StringConvert;
LIBPBD_API extern DebugBits DebugTimestamps;
/* See notes in ../debug.cc on why these are defined here */