summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-01 20:45:48 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-01 20:45:48 +0200
commit67bed0af05a795c9fc1db87bd2db526b8de59c65 (patch)
treeb82b77d89f919e15c31b722c68b1ee2d06517197 /src/lib
parent09df98b2b47f6f9a754d5ff8a1787da5a07c14b4 (diff)
Log errors from asdcplib in our logs.
Diffstat (limited to 'src/lib')
-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 7106cc782..cf66a8b5d 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"
@@ -422,6 +423,8 @@ LIBDCP_ENABLE_WARNINGS
curl_global_init (CURL_GLOBAL_ALL);
ui_thread = boost::this_thread::get_id ();
+
+ capture_asdcp_logs ();
}
#ifdef DCPOMATIC_WINDOWS
@@ -1168,3 +1171,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 e335434d8..fc4b1ed09 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -124,6 +124,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>