{"id":25846,"url":"https://patchwork.libcamera.org/api/1.1/patches/25846/?format=json","web_url":"https://patchwork.libcamera.org/patch/25846/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260119113104.3560802-2-barnabas.pocze@ideasonboard.com>","date":"2026-01-19T11:30:59","name":"[v2,1/5] treewide: Remove `libcamera::LOG(...)` occurrences","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"49c0c4c0c926575214cdedab0c52c743c0d45bff","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25846/mbox/","series":[{"id":5716,"url":"https://patchwork.libcamera.org/api/1.1/series/5716/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5716","date":"2026-01-19T11:30:58","name":"libcamera: base: log: Do not instantiate disabled `LogMessage`s","version":2,"mbox":"https://patchwork.libcamera.org/series/5716/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25846/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25846/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5A5A7BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Jan 2026 11:31:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 257F361FCA;\n\tMon, 19 Jan 2026 12:31:10 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09E5B61FA3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jan 2026 12:31:08 +0100 (CET)","from pb-laptop.local (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D473BE1;\n\tMon, 19 Jan 2026 12:30:37 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"r7RmNY6r\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768822237;\n\tbh=1quctgwdm0tnkABtF3rnkSIUDkcXlbJUKHu3rmdpEic=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=r7RmNY6rZkvWNLA2osIZaHnDYex1O6SrUlpvRTSWdK3tClL6qD4us7OvYgdYHUIT5\n\tylDuFWrjJv5Fwc8G8ijEjO6lHtEzYb30Oceupb5mQOga3PMx6WvDj59ggGithTOvCS\n\tATCE6rZBivh7Ea2BuRPBuVQqChpHg/sdgoW8rDeo=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v2 1/5] treewide: Remove `libcamera::LOG(...)` occurrences","Date":"Mon, 19 Jan 2026 12:30:59 +0100","Message-ID":"<20260119113104.3560802-2-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260119113104.3560802-1-barnabas.pocze@ideasonboard.com>","References":"<20260119113104.3560802-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"When a class inherits from `Loggable`, it will have a protected `_log()`\nfunction and that will be used instead of the global `_log()` function in\nthe expansion of the `LOG()` macro. However, if such a class has static member\nfunctions, then simply writing `LOG()` will not work because name lookup will\nfind the non-static member function and no the global function, resulting in a\ncompiler error because the non-static member cannot be invoked without an\nobject, and there is no object in a static member function.\n\nThis can be avoided by using `using libcamera::_log;`, thereby bringing the\nglobal declaration into the current scope.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/sensor/camera_sensor_raw.cpp |  8 +++++---\n src/libcamera/v4l2_device.cpp              | 10 ++++++----\n 2 files changed, 11 insertions(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp\nindex 759cccafe..81d8985ee 100644\n--- a/src/libcamera/sensor/camera_sensor_raw.cpp\n+++ b/src/libcamera/sensor/camera_sensor_raw.cpp\n@@ -172,10 +172,12 @@ CameraSensorRaw::~CameraSensorRaw() = default;\n std::variant<std::unique_ptr<CameraSensor>, int>\n CameraSensorRaw::match(MediaEntity *entity)\n {\n+\tusing libcamera::_log;\n+\n \t/* Check the entity type. */\n \tif (entity->type() != MediaEntity::Type::V4L2Subdevice ||\n \t    entity->function() != MEDIA_ENT_F_CAM_SENSOR) {\n-\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\tLOG(CameraSensor, Debug)\n \t\t\t<< entity->name() << \": unsupported entity type (\"\n \t\t\t<< utils::to_underlying(entity->type())\n \t\t\t<< \") or function (\" << utils::hex(entity->function()) << \")\";\n@@ -200,7 +202,7 @@ CameraSensorRaw::match(MediaEntity *entity)\n \t\t\tbreak;\n \n \t\tdefault:\n-\t\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\t\tLOG(CameraSensor, Debug)\n \t\t\t\t<< entity->name() << \": unsupported pad \" << pad->index()\n \t\t\t\t<< \" type \" << utils::hex(pad->flags());\n \t\t\treturn { 0 };\n@@ -208,7 +210,7 @@ CameraSensorRaw::match(MediaEntity *entity)\n \t}\n \n \tif (numSinks < 1 || numSinks > 2 || numSources != 1) {\n-\t\tlibcamera::LOG(CameraSensor, Debug)\n+\t\tLOG(CameraSensor, Debug)\n \t\t\t<< entity->name() << \": unsupported number of sinks (\"\n \t\t\t<< numSinks << \") or sources (\" << numSources << \")\";\n \t\treturn { 0 };\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 1582c03ef..b49d73b1c 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -1032,6 +1032,8 @@ template std::optional<ColorSpace> V4L2Device::toColorSpace(const struct v4l2_mb\n template<typename T>\n int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v4l2Format)\n {\n+\tusing libcamera::_log;\n+\n \tv4l2Format.colorspace = V4L2_COLORSPACE_DEFAULT;\n \tv4l2Format.xfer_func = V4L2_XFER_FUNC_DEFAULT;\n \tv4l2Format.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;\n@@ -1060,7 +1062,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itPrimaries != primariesToV4l2.end()) {\n \t\tv4l2Format.colorspace = itPrimaries->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised primaries in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1070,7 +1072,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itTransfer != transferFunctionToV4l2.end()) {\n \t\tv4l2Format.xfer_func = itTransfer->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised transfer function in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1080,7 +1082,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itYcbcrEncoding != ycbcrEncodingToV4l2.end()) {\n \t\tv4l2Format.ycbcr_enc = itYcbcrEncoding->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised YCbCr encoding in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n@@ -1090,7 +1092,7 @@ int V4L2Device::fromColorSpace(const std::optional<ColorSpace> &colorSpace, T &v\n \tif (itRange != rangeToV4l2.end()) {\n \t\tv4l2Format.quantization = itRange->second;\n \t} else {\n-\t\tlibcamera::LOG(V4L2, Warning)\n+\t\tLOG(V4L2, Warning)\n \t\t\t<< \"Unrecognised quantization in \"\n \t\t\t<< ColorSpace::toString(colorSpace);\n \t\tret = -EINVAL;\n","prefixes":["v2","1/5"]}