From e4e94e77c985aa2f0868fb4d7dbcefc27dd89f0b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 13 Oct 2020 21:46:52 +0200 Subject: [PATCH] Transmitter::Debug implementation 1/2 This also sorts switch() and listen_to() statements in order of severity: debug, info, warning, error, fatal, throw. --- headless/load_session.cc | 5 +-- headless/misc.cc | 9 ++-- libs/ardour/test/test_receiver.h | 3 ++ libs/ardour/test/test_ui.cc | 5 +-- libs/fst/scanner.cc | 14 +++--- libs/fst/vst3-scanner.cc | 11 +++-- libs/gtkmm2ext/gtk_ui.cc | 42 +++++++++++++---- libs/gtkmm2ext/gtkmm2ext/gtk_ui.h | 10 +++-- libs/midi++2/miditrace.cc | 8 ++-- libs/midi++2/mmctest.cc | 7 +-- libs/pbd/test/testrunner.cc | 4 +- luasession/luasession.cc | 14 +++--- session_utils/common.cc | 75 +++++++++++++++++-------------- session_utils/common.h | 9 ---- 14 files changed, 128 insertions(+), 88 deletions(-) diff --git a/headless/load_session.cc b/headless/load_session.cc index 0c2d01ecdb..b9d2ad192b 100644 --- a/headless/load_session.cc +++ b/headless/load_session.cc @@ -61,10 +61,9 @@ load_session (string dir, string state) { SessionEvent::create_per_thread_pool ("test", 512); - test_receiver.listen_to (error); - test_receiver.listen_to (info); - test_receiver.listen_to (fatal); test_receiver.listen_to (warning); + test_receiver.listen_to (error); + test_receiver.listen_to (fatal); AudioEngine* engine = AudioEngine::create (); diff --git a/headless/misc.cc b/headless/misc.cc index e1f298a27d..6652b2e716 100644 --- a/headless/misc.cc +++ b/headless/misc.cc @@ -28,15 +28,18 @@ TestReceiver::receive (Transmitter::Channel chn, const char * str) const char *prefix = ""; switch (chn) { - case Transmitter::Error: - prefix = ": [ERROR]: "; - break; + case Transmitter::Debug: + /* ignore */ + return; case Transmitter::Info: /* ignore */ return; case Transmitter::Warning: prefix = ": [WARNING]: "; break; + case Transmitter::Error: + prefix = ": [ERROR]: "; + break; case Transmitter::Fatal: prefix = ": [FATAL]: "; break; diff --git a/libs/ardour/test/test_receiver.h b/libs/ardour/test/test_receiver.h index 9bb5b65b55..bd9daf622d 100644 --- a/libs/ardour/test/test_receiver.h +++ b/libs/ardour/test/test_receiver.h @@ -33,6 +33,9 @@ protected: case Transmitter::Error: prefix = ": [ERROR]: "; break; + case Transmitter::Debug: + /* ignore */ + return; case Transmitter::Info: /* ignore */ return; diff --git a/libs/ardour/test/test_ui.cc b/libs/ardour/test/test_ui.cc index 60bc0e83c9..5d15fdf2d8 100644 --- a/libs/ardour/test/test_ui.cc +++ b/libs/ardour/test/test_ui.cc @@ -43,10 +43,9 @@ TestUI::TestUI () SessionEvent::create_per_thread_pool ("test", 512); - m_test_receiver.listen_to (PBD::error); - m_test_receiver.listen_to (PBD::info); - m_test_receiver.listen_to (PBD::fatal); m_test_receiver.listen_to (PBD::warning); + m_test_receiver.listen_to (PBD::error); + m_test_receiver.listen_to (PBD::fatal); /* We can't use VSTs here as we have a stub instead of the required bits in gtk2_ardour. diff --git a/libs/fst/scanner.cc b/libs/fst/scanner.cc index a1ce9963e0..e09aecd5a0 100644 --- a/libs/fst/scanner.cc +++ b/libs/fst/scanner.cc @@ -76,15 +76,18 @@ class DummyReceiver : public Receiver { void receive (Transmitter::Channel chn, const char * str) { const char *prefix = ""; switch (chn) { - case Transmitter::Error: - prefix = "[ERROR]: "; - break; + case Transmitter::Debug: + /* ignore */ + return; case Transmitter::Info: /* ignore */ return; case Transmitter::Warning: prefix = "[WARNING]: "; break; + case Transmitter::Error: + prefix = "[ERROR]: "; + break; case Transmitter::Fatal: prefix = "[FATAL]: "; break; @@ -130,10 +133,9 @@ int main (int argc, char **argv) { PBD::init(); - dummy_receiver.listen_to (error); - dummy_receiver.listen_to (info); - dummy_receiver.listen_to (fatal); dummy_receiver.listen_to (warning); + dummy_receiver.listen_to (error); + dummy_receiver.listen_to (fatal); std::vector *infos = 0; diff --git a/libs/fst/vst3-scanner.cc b/libs/fst/vst3-scanner.cc index 324d2eef01..0f4ae7973f 100644 --- a/libs/fst/vst3-scanner.cc +++ b/libs/fst/vst3-scanner.cc @@ -52,8 +52,8 @@ protected: void receive (Transmitter::Channel chn, const char * str) { const char *prefix = ""; switch (chn) { - case Transmitter::Error: - prefix = "[ERROR]: "; + case Transmitter::Debug: + /* ignore */ break; case Transmitter::Info: prefix = "[Info]: "; @@ -61,6 +61,9 @@ protected: case Transmitter::Warning: prefix = "[WARNING]: "; break; + case Transmitter::Error: + prefix = "[ERROR]: "; + break; case Transmitter::Fatal: prefix = "[FATAL]: "; break; @@ -191,10 +194,10 @@ main (int argc, char **argv) PBD::init(); if (print_log) { - log_receiver.listen_to (error); log_receiver.listen_to (info); - log_receiver.listen_to (fatal); log_receiver.listen_to (warning); + log_receiver.listen_to (error); + log_receiver.listen_to (fatal); } bool err = false; diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index ab6094a385..f8a1dc8dbe 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -162,6 +162,7 @@ UI::load_rcfile (string path, bool themechange) static Glib::RefPtr