diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-09-03 12:01:34 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-21 21:57:18 +0200 |
| commit | 08db8ff8a9875fe98acfd4746af293dfcc1087c2 (patch) | |
| tree | ed20730e877f00c48cd42b3061db9cc2ae8194ce /src | |
| parent | 1a79bdd8329d5a6b9c3e95b428b7bb6b72572d12 (diff) | |
Add ASDCPErrorSuspender to hide errors from asdcplib where we expect them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.cc | 17 | ||||
| -rw-r--r-- | src/util.h | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index f755c21e..c7d090ea 100644 --- a/src/util.cc +++ b/src/util.cc @@ -427,3 +427,20 @@ dcp::unique_string (list<string> existing, string base) DCP_ASSERT (false); } + + +ASDCPErrorSuspender::ASDCPErrorSuspender () + : _old (Kumu::DefaultLogSink()) +{ + _sink = new Kumu::EntryListLogSink(_log); + Kumu::SetDefaultLogSink (_sink); +} + + +ASDCPErrorSuspender::~ASDCPErrorSuspender () +{ + Kumu::SetDefaultLogSink (&_old); + delete _sink; +} + + @@ -41,6 +41,7 @@ #include "types.h" #include "data.h" #include "local_time.h" +#include <asdcp/KM_log.h> #include <boost/shared_ptr.hpp> #include <boost/function.hpp> #include <boost/filesystem.hpp> @@ -82,6 +83,20 @@ extern bool day_less_than_or_equal (LocalTime a, LocalTime b); extern bool day_greater_than_or_equal (LocalTime a, LocalTime b); extern std::string unique_string (std::list<std::string> existing, std::string base); + +class ASDCPErrorSuspender +{ +public: + ASDCPErrorSuspender(); + ~ASDCPErrorSuspender(); + +private: + Kumu::LogEntryList _log; + Kumu::ILogSink& _old; + Kumu::EntryListLogSink* _sink; +}; + + } #endif |
