From patchwork Thu Jun 23 14:47:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16340 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 04595BD808 for ; Thu, 23 Jun 2022 14:48:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F8BA6563F; Thu, 23 Jun 2022 16:48:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655995683; bh=EmB0VW8svYaSSYkOiGp3wWK3DCinwXd6t/TOpLxDyEk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fXnO4KqrO3fCP4oJz/kf5ppvNxfRPWiv+Ppo6G7/luM/JLkDjo38tlnzOmVxJmPJ7 Vl9GqgVbnDJssQ6Lap124okpyUKBJjDG5yCkGrt7q9G1zYNsgejdH8GaMu4I2VEH0D UtEhKSo0KZ6hBaL48EO0cGAWwOTaRese6T82BtyNosGk6AFoMy0pjDZ/X7AVfT3XVJ 4ssyir5lIC0Tu6EalTpDtpGWjABIByK5aVXNuYZaXl/R4s3GDU8xZeUKMndhVnSzsp kYxqeWb467/Dm9Mhiewmqt+g1OgILqzGRiYhebCD58WBpR0SF/HtZqEfdKP9VrI5yw yKTzF8pBs4LAQ== 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 5CB3265635 for ; Thu, 23 Jun 2022 16:47:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XhKTZ4SN"; dkim-atps=neutral Received: from deskari.lan (91-158-154-79.elisa-laajakaista.fi [91.158.154.79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D21FD80A; Thu, 23 Jun 2022 16:47:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655995678; bh=EmB0VW8svYaSSYkOiGp3wWK3DCinwXd6t/TOpLxDyEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhKTZ4SNMb0QFM2w1T0InsDtJnswbASpBP2Qf4KAKBRQpjWSWUEz5eYFEe1pllvq7 y/r5NEgJH+OmAp0sZvW8GZU0TxtST/57S1ACdMTqD2wVXoKwHyDIp9zN6Bo6xARHHR X55q/GZs5rgO2kozvx9BF43WITqMgdMps+M22kjY= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Thu, 23 Jun 2022 17:47:31 +0300 Message-Id: <20220623144736.78537-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220623144736.78537-1-tomi.valkeinen@ideasonboard.com> References: <20220623144736.78537-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC v1 2/7] py: Add Python logging category X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add Python logging category, and use it in handleRequestCompleted(). Signed-off-by: Tomi Valkeinen Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/py/libcamera/py_main.cpp | 8 ++++++-- src/py/libcamera/py_main.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/py/libcamera/py_main.h diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index 505cc3dc..17b17f60 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -5,6 +5,8 @@ * Python bindings */ +#include "py_main.h" + #include #include #include @@ -23,6 +25,8 @@ namespace py = pybind11; using namespace libcamera; +LOG_DEFINE_CATEGORY(Python) + template static py::object valueOrTuple(const ControlValue &cv) { @@ -120,10 +124,10 @@ static void handleRequestCompleted(Request *req) size_t s = write(gEventfd, &v, 8); /* * We should never fail, and have no simple means to manage the error, - * so let's use LOG(Fatal). + * so let's use LOG(Python, Fatal). */ if (s != 8) - LOG(Fatal) << "Unable to write to eventfd"; + LOG(Python, Fatal) << "Unable to write to eventfd"; } void init_py_enums(py::module &m); diff --git a/src/py/libcamera/py_main.h b/src/py/libcamera/py_main.h new file mode 100644 index 00000000..1b543a55 --- /dev/null +++ b/src/py/libcamera/py_main.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Tomi Valkeinen + */ + +#pragma once + +#include + +using namespace libcamera; + +LOG_DECLARE_CATEGORY(Python)