From patchwork Mon Jan 21 00:59:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 280 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E33BD60C6A for ; Mon, 21 Jan 2019 01:59:34 +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 6999BD6C for ; Mon, 21 Jan 2019 01:59:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548032374; bh=qSEzLIn4j8DjMOBfyvwJDkzEe6hFC7E7d9PIwgVWowo=; h=From:To:Subject:Date:From; b=HSVQXlPN5M/hYiWk8kKezX5jLe/Q+zw7FnGiwfC4dHF+R8Nf5u5OZK7xtjcVd+kp+ uqK6Uj+AiFOhuIi050LLU+kAoS3vWveuJf9DRqfMPF+ZMuAOxtpYEiLlbtmPI+x+cl TSCGAs0K/0gjXX5J2fK/R+tojtLRhXVznOWMvKtU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Jan 2019 02:59:24 +0200 Message-Id: <20190121005930.10112-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/6] 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 00:59:35 -0000 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(-)