From 8b8ae521347f293380f471285193aebbb3279f7d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 20 Jan 2019 15:03:01 +0200 Subject: libcamera: Use log categories Use log categories in the whole existing code base. Signed-off-by: Laurent Pinchart --- src/libcamera/event_dispatcher_poll.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/libcamera/event_dispatcher_poll.cpp') diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp index 2072ae0a..eefac54c 100644 --- a/src/libcamera/event_dispatcher_poll.cpp +++ b/src/libcamera/event_dispatcher_poll.cpp @@ -22,6 +22,8 @@ namespace libcamera { +LOG_DECLARE_CATEGORY(Event) + static const char *notifierType(EventNotifier::Type type) { if (type == EventNotifier::Read) @@ -53,8 +55,9 @@ void EventDispatcherPoll::registerEventNotifier(EventNotifier *notifier) EventNotifier::Type type = notifier->type(); if (set.notifiers[type] && set.notifiers[type] != notifier) { - LOG(Warning) << "Ignoring duplicate " << notifierType(type) - << " notifier for fd " << notifier->fd(); + LOG(Event, Warning) + << "Ignoring duplicate " << notifierType(type) + << " notifier for fd " << notifier->fd(); return; } @@ -74,8 +77,9 @@ void EventDispatcherPoll::unregisterEventNotifier(EventNotifier *notifier) return; if (set.notifiers[type] != notifier) { - LOG(Warning) << notifierType(type) << " notifier for fd " - << notifier->fd() << " is not registered"; + LOG(Event, Warning) + << notifierType(type) << " notifier for fd " + << notifier->fd() << " is not registered"; return; } @@ -141,9 +145,10 @@ void EventDispatcherPoll::processEvents() timeout.tv_nsec = 0; } - LOG(Debug) << "timeout " << timeout.tv_sec << "." - << std::setfill('0') << std::setw(9) - << timeout.tv_nsec; + LOG(Event, Debug) + << "timeout " << timeout.tv_sec << "." + << std::setfill('0') << std::setw(9) + << timeout.tv_nsec; } /* Wait for events and process notifiers and timers. */ @@ -151,7 +156,7 @@ void EventDispatcherPoll::processEvents() nextTimer ? &timeout : nullptr, nullptr); if (ret < 0) { ret = -errno; - LOG(Warning) << "poll() failed with " << strerror(-ret); + LOG(Event, Warning) << "poll() failed with " << strerror(-ret); } else if (ret > 0) { processNotifiers(pollfds); } @@ -201,9 +206,10 @@ void EventDispatcherPoll::processNotifiers(const std::vector &pol * notifier immediately. */ if (pfd.revents & POLLNVAL) { - LOG(Warning) << "Disabling " << notifierType(event.type) - << " due to invalid file descriptor " - << pfd.fd; + LOG(Event, Warning) + << "Disabling " << notifierType(event.type) + << " due to invalid file descriptor " + << pfd.fd; unregisterEventNotifier(notifier); continue; } -- cgit v1.2.1