summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-01 20:45:48 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-14 00:19:48 +0200
commitcd5ed3bbb45fc41e2c414276477eed2448d5a699 (patch)
treebc38146f7a0c0f8c46f6b2dff875b80188b7870f
parent1c57df596882f15403ee97d01862f8b76cfb797b (diff)
Log errors from asdcplib in our logs.
-rw-r--r--src/lib/util.cc30
-rw-r--r--src/lib/util.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index c964d8533..ed0de7595 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -34,6 +34,7 @@
#include "cross.h"
#include "crypto.h"
#include "dcp_content_type.h"
+#include "dcpomatic_log.h"
#include "digester.h"
#include "exceptions.h"
#include "ffmpeg_image_proxy.h"
@@ -424,6 +425,8 @@ LIBDCP_ENABLE_WARNINGS
curl_global_init (CURL_GLOBAL_ALL);
ui_thread = boost::this_thread::get_id ();
+
+ capture_asdcp_logs ();
}
#ifdef DCPOMATIC_WINDOWS
@@ -1148,3 +1151,30 @@ start_of_thread (string)
}
#endif
+
+class LogSink : public Kumu::ILogSink
+{
+public:
+ LogSink () {}
+ LogSink (LogSink const&) = delete;
+ LogSink& operator= (LogSink const&) = delete;
+
+ void WriteEntry(const Kumu::LogEntry& entry) override {
+ Kumu::AutoMutex L(m_lock);
+ WriteEntryToListeners(entry);
+ if (entry.TestFilter(m_filter)) {
+ string buffer;
+ entry.CreateStringWithOptions(buffer, m_options);
+ LOG_GENERAL("asdcplib: %1", buffer);
+ }
+ }
+};
+
+
+void
+capture_asdcp_logs ()
+{
+ static LogSink log_sink;
+ Kumu::SetDefaultLogSink(&log_sink);
+}
+
diff --git a/src/lib/util.h b/src/lib/util.h
index 5878d5937..fba5b6828 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -125,6 +125,7 @@ extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
extern boost::filesystem::path default_font_file ();
extern std::string to_upper (std::string s);
extern void start_of_thread (std::string name);
+extern void capture_asdcp_logs ();
template <class T>
std::list<T>