Moved AppendDebugMessage to ZmqLogger, and updated 100+ references to use this new function. Removed debug var from readers/writers, and moved it to ZmqLogger.Enable(true/false). This allows debug output from all classes and functions, without any duplicate code. Also added some additional debug output for video playback and audio readers.

This commit is contained in:
Jonathan Thomas
2016-04-21 01:39:17 -05:00
parent 30648360c7
commit 179d091005
17 changed files with 186 additions and 244 deletions

View File

@@ -58,55 +58,6 @@ WriterBase::WriterBase()
info.channel_layout = LAYOUT_MONO;
info.audio_stream_index = -1;
info.audio_timebase = Fraction();
// Initialize debug
debug = false;
}
// Append debug information as JSON
void WriterBase::AppendDebugMethod(string method_name, string arg1_name, float arg1_value,
string arg2_name, float arg2_value,
string arg3_name, float arg3_value,
string arg4_name, float arg4_value,
string arg5_name, float arg5_value,
string arg6_name, float arg6_value)
{
if (!debug)
// Don't do anything
return;
// Output to standard output
#pragma omp critical (debug_output)
{
stringstream message;
message << fixed << setprecision(4);
message << method_name << " (";
// Add attributes to method JSON
if (arg1_name.length() > 0)
message << arg1_name << "=" << arg1_value;
if (arg2_name.length() > 0)
message << ", " << arg2_name << "=" << arg2_value;
if (arg3_name.length() > 0)
message << ", " << arg3_name << "=" << arg3_value;
if (arg4_name.length() > 0)
message << ", " << arg4_name << "=" << arg4_value;
if (arg5_name.length() > 0)
message << ", " << arg5_name << "=" << arg5_value;
if (arg6_name.length() > 0)
message << ", " << arg6_name << "=" << arg6_value;
// Output to standard output
message << ")" << endl;
// Send message through ZMQ
ZmqLogger::Instance()->Log(message.str());
}
}
// This method copy's the info struct of a reader, and sets the writer with the same info