From 78bc6f9286864052b304a1871739479c16e393dd Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 30 Jun 2015 10:58:22 +0100 Subject: [PATCH] Calm down default logging a bit. --- src/lib/dcp_video.cc | 11 ++++++----- src/lib/log.cc | 3 ++- src/lib/log.h | 1 + src/lib/writer.cc | 9 +++++---- src/wx/config_dialog.cc | 9 +++++++++ 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index 3879947eb..7610e6c9f 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -59,6 +59,7 @@ #include #define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); +#define LOG_DEBUG_ENCODE(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_DEBUG_ENCODE); #include "i18n.h" @@ -223,13 +224,13 @@ DCPVideo::encode_locally (dcp::NoteHandler note) switch (_frame->eyes()) { case EYES_BOTH: - LOG_GENERAL (N_("Finished locally-encoded frame %1 for mono"), _index); + LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for mono"), _index); break; case EYES_LEFT: - LOG_GENERAL (N_("Finished locally-encoded frame %1 for L"), _index); + LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for L"), _index); break; case EYES_RIGHT: - LOG_GENERAL (N_("Finished locally-encoded frame %1 for R"), _index); + LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for R"), _index); break; default: break; @@ -266,7 +267,7 @@ DCPVideo::encode_remotely (ServerDescription serv) root->add_child("Version")->add_child_text (raw_convert (SERVER_LINK_VERSION)); add_metadata (root); - LOG_GENERAL (N_("Sending frame %1 to remote"), _index); + LOG_DEBUG_ENCODE (N_("Sending frame %1 to remote"), _index); /* Send XML metadata */ string xml = doc.write_to_string ("UTF-8"); @@ -282,7 +283,7 @@ DCPVideo::encode_remotely (ServerDescription serv) Data e (socket->read_uint32 ()); socket->read (e.data().get(), e.size()); - LOG_GENERAL (N_("Finished remotely-encoded frame %1"), _index); + LOG_DEBUG_ENCODE (N_("Finished remotely-encoded frame %1"), _index); return e; } diff --git a/src/lib/log.cc b/src/lib/log.cc index d9696f3cc..ac3277c4e 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -36,7 +36,8 @@ int const Log::TYPE_GENERAL = 0x1; int const Log::TYPE_WARNING = 0x2; int const Log::TYPE_ERROR = 0x4; int const Log::TYPE_DEBUG_DECODE = 0x8; -int const Log::TYPE_TIMING = 0x10; +int const Log::TYPE_DEBUG_ENCODE = 0x10; +int const Log::TYPE_TIMING = 0x20; Log::Log () : _types (0) diff --git a/src/lib/log.h b/src/lib/log.h index 6803f8d59..73a1aa582 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -43,6 +43,7 @@ public: static const int TYPE_WARNING; static const int TYPE_ERROR; static const int TYPE_DEBUG_DECODE; + static const int TYPE_DEBUG_ENCODE; static const int TYPE_TIMING; void log (std::string message, int type); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 7099f51c2..e911c3720 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -55,6 +55,7 @@ #include "i18n.h" #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); +#define LOG_DEBUG_ENCODE(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_DEBUG_ENCODE); #define LOG_TIMING(...) _film->log()->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING); #define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_WARNING); #define LOG_WARNING(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_WARNING); @@ -361,7 +362,7 @@ try switch (qi.type) { case QueueItem::FULL: { - LOG_GENERAL (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes); + LOG_DEBUG_ENCODE (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes); if (!qi.encoded) { qi.encoded = Data (_film->j2c_path (qi.frame, qi.eyes, false)); } @@ -373,13 +374,13 @@ try break; } case QueueItem::FAKE: - LOG_GENERAL (N_("Writer FAKE-writes %1"), qi.frame); + LOG_DEBUG_ENCODE (N_("Writer FAKE-writes %1"), qi.frame); _picture_asset_writer->fake_write (qi.size); _last_written[qi.eyes].reset (); ++_fake_written; break; case QueueItem::REPEAT: - LOG_GENERAL (N_("Writer REPEAT-writes %1"), qi.frame); + LOG_DEBUG_ENCODE (N_("Writer REPEAT-writes %1"), qi.frame); dcp::FrameInfo fin = _picture_asset_writer->write ( _last_written[qi.eyes]->data().get(), _last_written[qi.eyes]->size() @@ -678,7 +679,7 @@ Writer::check_existing_picture_asset () } } - LOG_GENERAL ("Have existing frame %1", _first_nonexistant_frame); + LOG_DEBUG_ENCODE ("Have existing frame %1", _first_nonexistant_frame); ++_first_nonexistant_frame; } diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 0c1ea29e5..34aaa7795 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -1119,6 +1119,7 @@ public: , _log_error (0) , _log_timing (0) , _log_debug_decode (0) + , _log_debug_encode (0) {} private: @@ -1161,6 +1162,8 @@ private: t->Add (_log_timing, 1, wxEXPAND | wxALL); _log_debug_decode = new wxCheckBox (_panel, wxID_ANY, _("Debug: decode")); t->Add (_log_debug_decode, 1, wxEXPAND | wxALL); + _log_debug_encode = new wxCheckBox (_panel, wxID_ANY, _("Debug: encode")); + t->Add (_log_debug_encode, 1, wxEXPAND | wxALL); table->Add (t, 0, wxALL, 6); } @@ -1178,6 +1181,7 @@ private: _log_error->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); _log_timing->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); _log_debug_decode->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); + _log_debug_encode->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this)); #ifdef DCPOMATIC_WINDOWS _win32_console->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::win32_console_changed, this)); #endif @@ -1194,6 +1198,7 @@ private: checked_set (_log_error, config->log_types() & Log::TYPE_ERROR); checked_set (_log_timing, config->log_types() & Log::TYPE_TIMING); checked_set (_log_debug_decode, config->log_types() & Log::TYPE_DEBUG_DECODE); + checked_set (_log_debug_encode, config->log_types() & Log::TYPE_DEBUG_ENCODE); #ifdef DCPOMATIC_WINDOWS checked_set (_win32_console, config->win32_console()); #endif @@ -1227,6 +1232,9 @@ private: if (_log_debug_decode->GetValue ()) { types |= Log::TYPE_DEBUG_DECODE; } + if (_log_debug_encode->GetValue ()) { + types |= Log::TYPE_DEBUG_ENCODE; + } Config::instance()->set_log_types (types); } @@ -1244,6 +1252,7 @@ private: wxCheckBox* _log_error; wxCheckBox* _log_timing; wxCheckBox* _log_debug_decode; + wxCheckBox* _log_debug_encode; #ifdef DCPOMATIC_WINDOWS wxCheckBox* _win32_console; #endif -- 2.30.2