From patchwork Wed Jun 29 07:04:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 16408 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 01B1EBE173 for ; Wed, 29 Jun 2022 07:04:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D615365638; Wed, 29 Jun 2022 09:04:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656486285; bh=GApko8Xk7fqa9bcs/6OBQN3OzWVj2WUfL+sa81qKAlw=; 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=JjP6a5mrM8rjl2ANwxFMYt+uAMmJBnyMCwj3v5y7oUUS8tLouUNCto3elFxusO592 YALk9SIjSEiibaf4iy/PTY2whCxilct4wpI8oReBywijyhG+olBMKzLLrrvvzI0FGw BGDLRG4Tgm7VTPdmSR39V5OmwMWM1Gc1wRTCcx3i6hq4BohOgpeZoSVoejrNHnIH5G H3s+FkLssgbOT4oZb7vt4nu5fNeStb9bxsR/A2A2TZ0+wKoG4nrPB9V664URrELONL mTf9IgCslxyQ/J6G5BZsYhyCsWnIREjOjHta7JYVJwAHMTebjMH8sWAOrdmflXp+b3 hAkRg2FqkVs8g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EB07865635 for ; Wed, 29 Jun 2022 09:04:40 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DGwnBM4R"; 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 6A5E76F0; Wed, 29 Jun 2022 09:04:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656486280; bh=GApko8Xk7fqa9bcs/6OBQN3OzWVj2WUfL+sa81qKAlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGwnBM4RX0woFczNqiqwQwyClG+eC5DO5k4sGrRx/qEjqM1BPpGI2jEMXz51vytZA jdM7Szwhwjha97wMT0Yr4VoDd0ep+56Fx3oL70B4Kga0+/PzD2UOBNM+DjesrkN20u mekYO9igeYp1axVw7GY/0C8Hvv4gUr5InXAPL5ts= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Wed, 29 Jun 2022 10:04:04 +0300 Message-Id: <20220629070416.17550-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220629070416.17550-1-tomi.valkeinen@ideasonboard.com> References: <20220629070416.17550-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/14] 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 | 12 ++++++++++-- src/py/libcamera/py_main.h | 14 ++++++++++++++ 2 files changed, 24 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..4b698f77 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,12 @@ namespace py = pybind11; using namespace libcamera; +namespace libcamera { + +LOG_DEFINE_CATEGORY(Python) + +} + template static py::object valueOrTuple(const ControlValue &cv) { @@ -120,10 +128,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 log a fatal error. */ 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..5bb5f2d1 --- /dev/null +++ b/src/py/libcamera/py_main.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Tomi Valkeinen + */ + +#pragma once + +#include + +namespace libcamera { + +LOG_DECLARE_CATEGORY(Python) + +}