X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Futil.cc;fp=src%2Flib%2Futil.cc;h=ed0de75959578cdd5016118c6c27f23c1d913b8a;hp=c964d853330ac5a7876f50919c22463fab54db17;hb=cd5ed3bbb45fc41e2c414276477eed2448d5a699;hpb=1c57df596882f15403ee97d01862f8b76cfb797b 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); +} +