From 2b8b8e74035197b874418d32bdeadbe23cdcfbdc Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 10 Dec 2016 23:36:35 -0800 Subject: [PATCH] Improve logging consistency by using source/sink name throughout. --- src/CvSinkImpl.cpp | 2 +- src/Log.h | 10 +++++ src/MjpegServerImpl.cpp | 71 +++++++++++++++++---------------- src/SourceImpl.cpp | 6 +-- src/UsbCameraImpl.cpp | 87 ++++++++++++++++++++--------------------- 5 files changed, 94 insertions(+), 82 deletions(-) diff --git a/src/CvSinkImpl.cpp b/src/CvSinkImpl.cpp index 4049e78402..97d63107ba 100644 --- a/src/CvSinkImpl.cpp +++ b/src/CvSinkImpl.cpp @@ -89,7 +89,7 @@ void CvSinkImpl::ThreadMain() { std::this_thread::sleep_for(std::chrono::seconds(1)); continue; } - DEBUG4("Cv: waiting for frame"); + SDEBUG4("waiting for frame"); Frame frame = source->GetNextFrame(); // blocks if (!m_active) break; if (!frame) { diff --git a/src/Log.h b/src/Log.h index 2e581b43b3..830600e713 100644 --- a/src/Log.h +++ b/src/Log.h @@ -40,6 +40,16 @@ class Logger : public wpi::Logger { #define DEBUG3(x) WPI_DEBUG3(cs::Logger::GetInstance(), x) #define DEBUG4(x) WPI_DEBUG4(cs::Logger::GetInstance(), x) +#define SERROR(x) ERROR(GetName() << ": " << x) +#define SWARNING(x) WARNING(GetName() << ": " << x) +#define SINFO(x) INFO(GetName() << ": " << x) + +#define SDEBUG(x) DEBUG(GetName() << ": " << x) +#define SDEBUG1(x) DEBUG1(GetName() << ": " << x) +#define SDEBUG2(x) DEBUG2(GetName() << ": " << x) +#define SDEBUG3(x) DEBUG3(GetName() << ": " << x) +#define SDEBUG4(x) DEBUG4(GetName() << ": " << x) + } // namespace cs #endif // CS_LOG_H_ diff --git a/src/MjpegServerImpl.cpp b/src/MjpegServerImpl.cpp index 54b39ec0b3..2148fc1221 100644 --- a/src/MjpegServerImpl.cpp +++ b/src/MjpegServerImpl.cpp @@ -39,6 +39,8 @@ static const char* rootPage = class MjpegServerImpl::ConnThread : public wpi::SafeThread { public: + ConnThread(llvm::StringRef name) : m_name(name) {} + void Main(); bool ProcessCommand(llvm::raw_ostream& os, SourceImpl& source, @@ -52,6 +54,9 @@ class MjpegServerImpl::ConnThread : public wpi::SafeThread { bool m_streaming = false; private: + std::string m_name; + llvm::StringRef GetName() { return m_name; } + std::shared_ptr GetSource() { std::lock_guard lock(m_mutex); return m_source; @@ -144,8 +149,8 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, if (rawParam.empty()) continue; // ignore "&&" std::tie(rawParam, rawValue) = rawParam.split('='); if (rawParam.empty() || rawValue.empty()) continue; // ignore "param=" - DEBUG4("HTTP parameter \"" << rawParam << "\" value \"" << rawValue - << "\""); + SDEBUG4("HTTP parameter \"" << rawParam << "\" value \"" << rawValue + << "\""); // unescape param bool error = false; @@ -156,7 +161,7 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, llvm::raw_svector_ostream oss{error}; oss << "could not unescape parameter \"" << rawParam << "\""; SendError(os, 500, error.str()); - DEBUG(error.str()); + SDEBUG(error.str()); return false; } @@ -168,7 +173,7 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, llvm::raw_svector_ostream oss{error}; oss << "could not unescape value \"" << rawValue << "\""; SendError(os, 500, error.str()); - DEBUG(error.str()); + SDEBUG(error.str()); return false; } @@ -180,20 +185,20 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, int width, height; if (widthStr.getAsInteger(10, width)) { response << param << ": \"width is not integer\"\r\n"; - WARNING("HTTP parameter \"" << param << "\" width \"" << widthStr - << "\" is not integer"); + SWARNING("HTTP parameter \"" << param << "\" width \"" << widthStr + << "\" is not integer"); continue; } if (heightStr.getAsInteger(10, height)) { response << param << ": \"height is not integer\"\r\n"; - WARNING("HTTP parameter \"" << param << "\" height \"" << heightStr - << "\" is not integer"); + SWARNING("HTTP parameter \"" << param << "\" height \"" << heightStr + << "\" is not integer"); continue; } CS_Status status = 0; if (!source.SetResolution(width, height, &status)) { response << param << ": \"error\"\r\n"; - WARNING("Could not set resolution to " << width << "x" << height); + SWARNING("Could not set resolution to " << width << "x" << height); } else { response << param << ": \"ok\"\r\n"; } @@ -204,14 +209,14 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, int fps; if (value.getAsInteger(10, fps)) { response << param << ": \"invalid integer\"\r\n"; - WARNING("HTTP parameter \"" << param << "\" value \"" << value - << "\" is not an integer"); + SWARNING("HTTP parameter \"" << param << "\" value \"" << value + << "\" is not an integer"); continue; } CS_Status status = 0; if (!source.SetFPS(fps, &status)) { response << param << ": \"error\"\r\n"; - WARNING("Could not set FPS to " << fps); + SWARNING("Could not set FPS to " << fps); } else { response << param << ": \"ok\"\r\n"; } @@ -226,7 +231,7 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, if (!prop) { if (param == "compression") continue; // silently ignore response << param << ": \"ignored\"\r\n"; - WARNING("ignoring HTTP parameter \"" << param << "\""); + SWARNING("ignoring HTTP parameter \"" << param << "\""); continue; } @@ -239,18 +244,18 @@ bool MjpegServerImpl::ConnThread::ProcessCommand(llvm::raw_ostream& os, int val; if (value.getAsInteger(10, val)) { response << param << ": \"invalid integer\"\r\n"; - WARNING("HTTP parameter \"" << param << "\" value \"" << value - << "\" is not an integer"); + SWARNING("HTTP parameter \"" << param << "\" value \"" << value + << "\" is not an integer"); } else { response << param << ": " << val << "\r\n"; - DEBUG4("HTTP parameter \"" << param << "\" value " << value); + SDEBUG4("HTTP parameter \"" << param << "\" value " << value); source.SetProperty(prop, val, &status); } break; } case CS_PROP_STRING: { response << param << ": \"ok\"\r\n"; - DEBUG4("HTTP parameter \"" << param << "\" value \"" << value << "\""); + SDEBUG4("HTTP parameter \"" << param << "\" value \"" << value << "\""); source.SetStringProperty(prop, value, &status); break; } @@ -387,7 +392,7 @@ void MjpegServerImpl::ConnThread::SendStream(wpi::raw_socket_ostream& os) { "Access-Control-Allow-Origin: *"); os << oss.str(); - DEBUG("HTTP: Headers send, sending stream now"); + SDEBUG("Headers send, sending stream now"); StartStream(); while (m_active && !os.has_error()) { @@ -397,7 +402,7 @@ void MjpegServerImpl::ConnThread::SendStream(wpi::raw_socket_ostream& os) { std::this_thread::sleep_for(std::chrono::seconds(1)); continue; } - DEBUG4("HTTP: waiting for frame"); + SDEBUG4("waiting for frame"); Frame frame = source->GetNextFrame(); // blocks if (!m_active) break; if (!frame) { @@ -424,7 +429,7 @@ void MjpegServerImpl::ConnThread::SendStream(wpi::raw_socket_ostream& os) { continue; } - DEBUG4("HTTP: sending frame size=" << size); + SDEBUG4("sending frame size=" << size); // print the individual mimetype and the length // sending the content-length fixes random stream disruption observed @@ -459,7 +464,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { llvm::SmallString<128> reqBuf; llvm::StringRef req = ReadLine(is, reqBuf, 4096, &error); if (error) { - DEBUG("HTTP error getting request string"); + SDEBUG("error getting request string"); return; } @@ -467,7 +472,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { llvm::StringRef parameters; size_t pos; - DEBUG("HTTP request: '" << req << "'\n"); + SDEBUG("HTTP request: '" << req << "'\n"); // Determine request kind. Most of these are for mjpgstreamer // compatibility, others are for Axis camera compatibility. @@ -496,7 +501,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { } else if (req.find("GET / ") != llvm::StringRef::npos || req == "GET /\n") { kind = kRootPage; } else { - DEBUG("HTTP request resource not found"); + SDEBUG("HTTP request resource not found"); SendError(os, 404, "Resource not found"); return; } @@ -506,7 +511,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" "-=&1234567890%./"); parameters = parameters.substr(0, pos); - DEBUG("command parameters: \"" << parameters << "\""); + SDEBUG("command parameters: \"" << parameters << "\""); // Read the rest of the HTTP request. // The end of the request is marked by a single, empty line @@ -520,7 +525,7 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { switch (kind) { case kStream: if (auto source = GetSource()) { - DEBUG("request for stream " << source->GetName()); + SDEBUG("request for stream " << source->GetName()); if (!ProcessCommand(os, *source, parameters, false)) return; } SendStream(os); @@ -531,24 +536,24 @@ void MjpegServerImpl::ConnThread::ProcessRequest() { } else { SendHeader(os, 200, "OK", "text/plain"); os << "Ignored due to no connected source." << "\r\n"; - DEBUG("Ignored due to no connected source."); + SDEBUG("Ignored due to no connected source."); } break; case kGetSettings: - DEBUG("request for JSON file"); + SDEBUG("request for JSON file"); if (auto source = GetSource()) SendJSON(os, *source, true); else SendError(os, 404, "Resource not found"); break; case kRootPage: - DEBUG("request for root page"); + SDEBUG("request for root page"); SendHeader(os, 200, "OK", "text/html"); os << rootPage << "\r\n"; break; } - DEBUG("leaving HTTP client thread"); + SDEBUG("leaving HTTP client thread"); } // worker thread for clients that connected to this server @@ -573,7 +578,7 @@ void MjpegServerImpl::ServerThreadMain() { return; } - DEBUG("waiting for clients to connect"); + SDEBUG("waiting for clients to connect"); while (m_active) { auto stream = m_acceptor->accept(); if (!stream) { @@ -582,7 +587,7 @@ void MjpegServerImpl::ServerThreadMain() { } if (!m_active) return; - DEBUG("server: client connection from " << stream->getPeerIP()); + SDEBUG("client connection from " << stream->getPeerIP()); auto source = GetSource(); @@ -601,7 +606,7 @@ void MjpegServerImpl::ServerThreadMain() { // Start it if not already started { auto thr = it->GetThread(); - if (!thr) it->Start(); + if (!thr) it->Start(new ConnThread{GetName()}); } // Hand off connection to it @@ -611,7 +616,7 @@ void MjpegServerImpl::ServerThreadMain() { thr->m_cond.notify_one(); } - DEBUG("leaving server thread"); + SDEBUG("leaving server thread"); } void MjpegServerImpl::SetSourceImpl(std::shared_ptr source) { diff --git a/src/SourceImpl.cpp b/src/SourceImpl.cpp index d3ad6a9613..8bcac77235 100644 --- a/src/SourceImpl.cpp +++ b/src/SourceImpl.cpp @@ -305,9 +305,9 @@ void SourceImpl::PutFrame(VideoMode::PixelFormat pixelFormat, int width, AllocFrame(pixelFormat, width, height, data.size(), time); // Copy in image data - DEBUG4("Copying data to " << ((void*)frameData->data) << " from " - << ((void*)data.data()) << " (" << data.size() - << " bytes)"); + SDEBUG4("Copying data to " << ((void*)frameData->data) << " from " + << ((void*)data.data()) << " (" << data.size() + << " bytes)"); std::memcpy(frameData->data, data.data(), data.size()); PutFrame(std::move(frameData)); diff --git a/src/UsbCameraImpl.cpp b/src/UsbCameraImpl.cpp index cae8bd13e0..5679c69243 100644 --- a/src/UsbCameraImpl.cpp +++ b/src/UsbCameraImpl.cpp @@ -484,7 +484,7 @@ void UsbCameraImpl::CameraThreadMain() { DoFdSet(notify_fd, &readfds, &nfds); if (select(nfds, &readfds, nullptr, nullptr, &tv) < 0) { - ERROR("USB select(): " << strerror(errno)); + SERROR("select(): " << strerror(errno)); break; // XXX: is this the right thing to do here? } @@ -493,7 +493,7 @@ void UsbCameraImpl::CameraThreadMain() { // Handle notify events if (notify_fd >= 0 && FD_ISSET(notify_fd, &readfds)) { - DEBUG4("USB " << m_path << ": notify event"); + SDEBUG4("notify event"); struct inotify_event event; do { // Read the event structure @@ -504,9 +504,9 @@ void UsbCameraImpl::CameraThreadMain() { notify_is->read(raw_name.data(), event.len); // If the name is what we expect... llvm::StringRef name{raw_name.c_str()}; - DEBUG4("USB " << m_path << ": got event on '" << name << "' (" - << name.size() << ") compare to '" << base << "' (" - << base.size() << ") mask " << event.mask); + SDEBUG4("got event on '" << name << "' (" << name.size() + << ") compare to '" << base << "' (" + << base.size() << ") mask " << event.mask); if (name == base) { if ((event.mask & IN_DELETE) != 0) { wasStreaming = m_streaming; @@ -523,7 +523,7 @@ void UsbCameraImpl::CameraThreadMain() { // Handle commands if (command_fd >= 0 && FD_ISSET(command_fd, &readfds)) { - DEBUG4("USB " << m_path << ": got command"); + SDEBUG4("got command"); // Read it to clear eventfd_t val; eventfd_read(command_fd, &val); @@ -533,7 +533,7 @@ void UsbCameraImpl::CameraThreadMain() { // Handle frames if (m_streaming && fd >= 0 && FD_ISSET(fd, &readfds)) { - DEBUG4("USB " << m_path << ": grabbing image"); + SDEBUG4("grabbing image"); // Dequeue buffer struct v4l2_buffer buf; @@ -541,7 +541,7 @@ void UsbCameraImpl::CameraThreadMain() { buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (DoIoctl(fd, VIDIOC_DQBUF, &buf) != 0) { - WARNING("USB " << m_path << ": could not dequeue buffer"); + SWARNING("could not dequeue buffer"); wasStreaming = m_streaming; DeviceStreamOff(); DeviceDisconnect(); @@ -550,11 +550,10 @@ void UsbCameraImpl::CameraThreadMain() { } if ((buf.flags & V4L2_BUF_FLAG_ERROR) == 0) { - DEBUG4("USB " << m_path << ": got image size=" << buf.bytesused - << " index=" << buf.index); + SDEBUG4("got image size=" << buf.bytesused << " index=" << buf.index); if (buf.index >= kNumBuffers || !m_buffers[buf.index].m_data) { - WARNING("USB " << m_path << ": invalid buffer" << buf.index); + SWARNING("invalid buffer" << buf.index); continue; } @@ -568,7 +567,7 @@ void UsbCameraImpl::CameraThreadMain() { // Requeue buffer if (DoIoctl(fd, VIDIOC_QBUF, &buf) != 0) { - WARNING("USB " << m_path << ": could not requeue buffer"); + SWARNING("could not requeue buffer"); wasStreaming = m_streaming; DeviceStreamOff(); DeviceDisconnect(); @@ -601,16 +600,16 @@ void UsbCameraImpl::DeviceDisconnect() { void UsbCameraImpl::DeviceConnect() { if (m_fd >= 0) return; - INFO("Connecting to USB camera on " << m_path); + SINFO("Connecting to USB camera on " << m_path); // Try to open the device - DEBUG3("USB " << m_path << ": opening device"); + SDEBUG3("opening device"); int fd = open(m_path.c_str(), O_RDWR); if (fd < 0) return; m_fd = fd; // Get capabilities - DEBUG3("USB " << m_path << ": getting capabilities"); + SDEBUG3("getting capabilities"); struct v4l2_capability vcap; std::memset(&vcap, 0, sizeof(vcap)); if (DoIoctl(fd, VIDIOC_QUERYCAP, &vcap) >= 0) { @@ -621,43 +620,43 @@ void UsbCameraImpl::DeviceConnect() { // Get or restore video mode if (!m_properties_cached) { - DEBUG3("USB " << m_path << ": caching properties"); + SDEBUG3("caching properties"); DeviceCacheProperties(); DeviceCacheVideoModes(); DeviceCacheMode(); m_properties_cached = true; } else { - DEBUG3("USB " << m_path << ": restoring video mode"); + SDEBUG3("restoring video mode"); DeviceSetMode(); DeviceSetFPS(); // Restore settings - DEBUG3("USB " << m_path << ": restoring settings"); + SDEBUG3("restoring settings"); std::unique_lock lock2(m_mutex); for (std::size_t i = 0; i < m_propertyData.size(); ++i) { const auto& prop = m_propertyData[i]; if (!prop || !prop->valueSet) continue; if (!DeviceSetProperty(lock2, static_cast(*prop))) - WARNING("USB " << m_path << ": failed to set property " << prop->name); + SWARNING("failed to set property " << prop->name); } } // Request buffers - DEBUG3("USB " << m_path << ": allocating buffers"); + SDEBUG3("allocating buffers"); struct v4l2_requestbuffers rb; std::memset(&rb, 0, sizeof(rb)); rb.count = kNumBuffers; rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; rb.memory = V4L2_MEMORY_MMAP; if (DoIoctl(fd, VIDIOC_REQBUFS, &rb) != 0) { - WARNING("USB " << m_path << ": could not allocate buffers"); + SWARNING("could not allocate buffers"); close(fd); m_fd = -1; return; } // Map buffers - DEBUG3("USB " << m_path << ": mapping buffers"); + SDEBUG3("mapping buffers"); for (int i = 0; i < kNumBuffers; ++i) { struct v4l2_buffer buf; std::memset(&buf, 0, sizeof(buf)); @@ -665,17 +664,17 @@ void UsbCameraImpl::DeviceConnect() { buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (DoIoctl(fd, VIDIOC_QUERYBUF, &buf) != 0) { - WARNING("USB " << m_path << ": could not query buffer " << i); + SWARNING("could not query buffer " << i); close(fd); m_fd = -1; return; } - DEBUG4("USB " << m_path << ": buf " << i << " length=" << buf.length - << " offset=" << buf.m.offset); + SDEBUG4("buf " << i << " length=" << buf.length + << " offset=" << buf.m.offset); m_buffers[i] = std::move(UsbCameraBuffer(fd, buf.length, buf.m.offset)); if (!m_buffers[i].m_data) { - WARNING("USB " << m_path << ": could not map buffer " << i); + SWARNING("could not map buffer " << i); // release other buffers for (int j = 0; j < i; ++j) m_buffers[j] = std::move(UsbCameraBuffer{}); close(fd); @@ -683,8 +682,7 @@ void UsbCameraImpl::DeviceConnect() { return; } - DEBUG4("USB " << m_path << ": buf " << i - << " address=" << m_buffers[i].m_data); + SDEBUG4("buf " << i << " address=" << m_buffers[i].m_data); } // Update description (as it may have changed) @@ -700,7 +698,7 @@ bool UsbCameraImpl::DeviceStreamOn() { if (fd < 0) return false; // Queue buffers - DEBUG3("USB " << m_path << ": queuing buffers"); + SDEBUG3("queuing buffers"); for (int i = 0; i < kNumBuffers; ++i) { struct v4l2_buffer buf; std::memset(&buf, 0, sizeof(buf)); @@ -708,7 +706,7 @@ bool UsbCameraImpl::DeviceStreamOn() { buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (DoIoctl(fd, VIDIOC_QBUF, &buf) != 0) { - WARNING("USB " << m_path << ": could not queue buffer " << i); + SWARNING("could not queue buffer " << i); return false; } } @@ -716,7 +714,7 @@ bool UsbCameraImpl::DeviceStreamOn() { // Turn stream on int type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (DoIoctl(fd, VIDIOC_STREAMON, &type) != 0) return false; - DEBUG4("USB " << m_path << ": enabled streaming"); + SDEBUG4("enabled streaming"); m_streaming = true; return true; } @@ -727,7 +725,7 @@ bool UsbCameraImpl::DeviceStreamOff() { if (fd < 0) return false; int type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (DoIoctl(fd, VIDIOC_STREAMOFF, &type) != 0) return false; - DEBUG4("USB " << m_path << ": disabled streaming"); + SDEBUG4("disabled streaming"); m_streaming = false; return true; } @@ -900,8 +898,8 @@ void UsbCameraImpl::DeviceSetMode() { vfmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565; break; default: - WARNING("USB " << m_path << ": could not set format " - << m_mode.pixelFormat << ", defaulting to MJPEG"); + SWARNING("could not set format " << m_mode.pixelFormat + << ", defaulting to MJPEG"); vfmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG; break; } @@ -909,12 +907,11 @@ void UsbCameraImpl::DeviceSetMode() { vfmt.fmt.pix.height = m_mode.height; vfmt.fmt.pix.field = V4L2_FIELD_ANY; if (DoIoctl(fd, VIDIOC_S_FMT, &vfmt) != 0) { - WARNING("USB " << m_path << ": could not set format " - << m_mode.pixelFormat << " res " << m_mode.width << "x" - << m_mode.height); + SWARNING("could not set format " << m_mode.pixelFormat << " res " + << m_mode.width << "x" << m_mode.height); } else { - INFO("USB " << m_path << ": set format " << m_mode.pixelFormat << " res " - << m_mode.width << "x" << m_mode.height); + SINFO("set format " << m_mode.pixelFormat << " res " << m_mode.width << "x" + << m_mode.height); } } @@ -931,9 +928,9 @@ void UsbCameraImpl::DeviceSetFPS() { parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; parm.parm.capture.timeperframe = FPSToFract(m_mode.fps); if (DoIoctl(fd, VIDIOC_S_PARM, &parm) != 0) - WARNING("USB " << m_path << ": could not set FPS to " << m_mode.fps); + SWARNING("could not set FPS to " << m_mode.fps); else - INFO("USB " << m_path << ": set FPS to " << m_mode.fps); + SINFO("set FPS to " << m_mode.fps); } void UsbCameraImpl::DeviceCacheMode() { @@ -950,7 +947,7 @@ void UsbCameraImpl::DeviceCacheMode() { #endif vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (DoIoctl(fd, VIDIOC_G_FMT, &vfmt) != 0) { - ERROR("USB " << m_path << ": could not read current video mode"); + SERROR("could not read current video mode"); std::lock_guard lock(m_mutex); m_mode = VideoMode{VideoMode::kMJPEG, 320, 240, 30}; return; @@ -1051,7 +1048,7 @@ void UsbCameraImpl::DeviceCacheProperty(std::unique_ptr prop) { // get the value lock.unlock(); if (!DeviceGetProperty(prop.get())) - WARNING("USB " << m_path << ": failed to get property " << prop->name); + SWARNING("failed to get property " << prop->name); lock.lock(); // create a new index ndx = m_propertyData.size() + 1; @@ -1066,11 +1063,11 @@ void UsbCameraImpl::DeviceCacheProperty(std::unique_ptr prop) { if (prop->valueSet) { // set the value if it was previously set if (!DeviceSetProperty(lock, *prop)) - WARNING("USB " << m_path << ": failed to set property " << prop->name); + SWARNING("failed to set property " << prop->name); } else { // otherwise get the value if (!DeviceGetProperty(prop.get())) - WARNING("USB " << m_path << ": failed to get property " << prop->name); + SWARNING("failed to get property " << prop->name); } lock.lock(); m_propertyData[ndx - 1] = std::move(prop);