From patchwork Mon Jan 21 19:56:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 311 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BCEB360C80 for ; Mon, 21 Jan 2019 20:56:11 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 41A6853E for ; Mon, 21 Jan 2019 20:56:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548100571; bh=MEDWbrLHz/VVOur77hno6YCYxVHH0uxhO3ncyICJ0c8=; h=From:To:Subject:Date:From; b=ad86dr6zjoxphHyg85VDhn0DugYScgR+mUt8A69kiLaKaPx6m3v1UeQ8yUnjH7+rb efDzoVnU+AMZE1K5UEE2Pdm39zvtxtV5f4VZENj83DbkpJaS6HwMiECdPM4LlIQdvO FfoTcMvWhqtsJhTOf2XfDWTveiyOaes9dZhw4ryY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Jan 2019 21:56:02 +0200 Message-Id: <20190121195606.8526-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/4] Extend the logger with categories and configuration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2019 19:56:11 -0000 Hello, This patch series extends the logging infrastructure with support for logging categories, and implements configuration of the logger from environment variables. Patch 1/4 adds log categories, patch 2/4 and 3/4 configure log levels and the log output file from environment variables, and patch 4/4 makes uses of categories through the code base. Compared to v1, two merged patches have been dropped, and the LOG() and LOG() macros have been merged together, with the documentation updated accordingly. As with v1, I'm not entirely happy with the following: - I would like the LOG() macro to automatically log to the category defined with LOG_DEFINE_CATEGORY() (or declared with LOG_DECLARE_CATEGORY()) when used without an explicit category and 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, it is still an exercise for the reader. - A test case for log environment variables parsing would be nice, but that's hard to do as the implementation is very private. - Patch 4/4 heavily violates checkstyle.py, and after digging into the astyle options I unfortunately found out that the indentation for this specific case is hardcoded. However, the new clang-format support for checkstyle.py doesn't complain, so I'm enclined to leave it as-is. - Documenting the LOG() macro properly and hiding the internal macros from log.h without any doxygen warning required adding a #ifndef __DOXYGEN__ in log.h, which I don't like much. I don't think any of those issues are blockers, so I plan to push the patches to the master branch soon. Laurent Pinchart (4): 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/Doxyfile.in | 2 +- 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 | 56 ++- src/libcamera/log.cpp | 436 ++++++++++++++++++++++-- src/libcamera/media_device.cpp | 52 +-- src/libcamera/media_object.cpp | 7 +- src/libcamera/pipeline_handler.cpp | 5 +- src/libcamera/timer.cpp | 7 +- src/libcamera/v4l2_device.cpp | 25 +- 12 files changed, 561 insertions(+), 100 deletions(-)