[libcamera-devel,0/6] Extend the logger with categories and configuration
mbox series

Message ID 20190121005930.10112-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • Extend the logger with categories and configuration
Related show

Message

Laurent Pinchart Jan. 21, 2019, 12:59 a.m. UTC
Hello,

This patch series extends the logging infrastructure with support for
logging categories, and implements configuration of the logger from
environment variables.

The series starts with two unrelated patches that are quite
self-explicit. It then moves on to add log categories in patch 3/6, and
configuration of log levels and log output file in patches 4/6 and 5/6
respectively. Patch 6/6 finally updates all LOG() calls to make use of
categories.

There are still a few points I'm not entirely happy with:

- I would like the LOG() macro to automatically log to the category
  defined with LOG_DEFINE_CATEGORY() (or declared with
  LOG_DECLARE_CATEGORY()) when the compilation unit has a single
  category declared (or possibly the first or last category declared
  when there are several). I haven't found a good way to implement this.

- A test case for log environment variables parsing would be nice, but
  that's hard to do as the implementation is very private.

- Patch 6/6 heavily violates checkstyle.py. I think our astyle style
  should be updated, but I haven't checked whether that is doable.
  Bonus points if someone beats me to it.

The first two items are not blockers in my opinion, the last one is more
problematic.

Laurent Pinchart (6):
  Documentation: coding_style: Add move semantics to C++11 features
  libcamera: signal: Enable documentation generation from signal.h file
  libcamera: log: Add log categories
  libcamera: log: Get log levels from the environment
  libcamera: log: Get log output file from the environment
  libcamera: Use log categories

 Documentation/coding-style.rst          |   1 +
 src/libcamera/camera_manager.cpp        |  14 +-
 src/libcamera/device_enumerator.cpp     |  25 +-
 src/libcamera/event_dispatcher.cpp      |   4 +
 src/libcamera/event_dispatcher_poll.cpp |  28 +-
 src/libcamera/include/log.h             |  45 ++-
 src/libcamera/log.cpp                   | 460 ++++++++++++++++++++++--
 src/libcamera/media_device.cpp          |  48 +--
 src/libcamera/media_object.cpp          |   7 +-
 src/libcamera/pipeline_handler.cpp      |   5 +-
 src/libcamera/signal.cpp                |   5 +
 src/libcamera/timer.cpp                 |   6 +-
 src/libcamera/v4l2_device.cpp           |  25 +-
 13 files changed, 574 insertions(+), 99 deletions(-)