Append debug information
| 176 | |
| 177 | // Append debug information |
| 178 | void ZmqLogger::AppendDebugMethod(std::string method_name, |
| 179 | std::string arg1_name, float arg1_value, |
| 180 | std::string arg2_name, float arg2_value, |
| 181 | std::string arg3_name, float arg3_value, |
| 182 | std::string arg4_name, float arg4_value, |
| 183 | std::string arg5_name, float arg5_value, |
| 184 | std::string arg6_name, float arg6_value) |
| 185 | { |
| 186 | if (!enabled && !openshot::Settings::Instance()->DEBUG_TO_STDERR) |
| 187 | // Don't do anything |
| 188 | return; |
| 189 | |
| 190 | { |
| 191 | // Create a scoped lock, allowing only a single thread to run the following code at one time |
| 192 | const std::lock_guard<std::recursive_mutex> lock(loggerMutex); |
| 193 | |
| 194 | std::stringstream message; |
| 195 | message << std::fixed << std::setprecision(4); |
| 196 | |
| 197 | // Construct message |
| 198 | message << method_name << " ("; |
| 199 | |
| 200 | if (arg1_name.length() > 0) |
| 201 | message << arg1_name << "=" << arg1_value; |
| 202 | |
| 203 | if (arg2_name.length() > 0) |
| 204 | message << ", " << arg2_name << "=" << arg2_value; |
| 205 | |
| 206 | if (arg3_name.length() > 0) |
| 207 | message << ", " << arg3_name << "=" << arg3_value; |
| 208 | |
| 209 | if (arg4_name.length() > 0) |
| 210 | message << ", " << arg4_name << "=" << arg4_value; |
| 211 | |
| 212 | if (arg5_name.length() > 0) |
| 213 | message << ", " << arg5_name << "=" << arg5_value; |
| 214 | |
| 215 | if (arg6_name.length() > 0) |
| 216 | message << ", " << arg6_name << "=" << arg6_value; |
| 217 | |
| 218 | message << ")" << std::endl; |
| 219 | |
| 220 | if (openshot::Settings::Instance()->DEBUG_TO_STDERR) { |
| 221 | // Print message to stderr |
| 222 | std::clog << message.str(); |
| 223 | } |
| 224 | |
| 225 | if (enabled) { |
| 226 | // Send message through ZMQ |
| 227 | Log(message.str()); |
| 228 | } |
| 229 | } |
| 230 | } |
no outgoing calls
no test coverage detected