From patchwork Mon Jul 7 08:55:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23752 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 16E76C3237 for ; Mon, 7 Jul 2025 08:55:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B140068E8C; Mon, 7 Jul 2025 10:55:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NtB3Hy/X"; dkim-atps=neutral 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 461AD68E7F for ; Mon, 7 Jul 2025 10:55:43 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:c79f:85df:e7f5:4c31]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 87E21190D; Mon, 7 Jul 2025 10:55:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1751878516; bh=C1MQ014R0VPNE4SJ8AWH6q4meRaMz4TkQggRdCowNLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NtB3Hy/XcpspmtbauWBUhHGyyT41OoWmPtLKnnk6U/9AUaXZ1Ofm0r8BDXZRb1xtc jXEQxD8sEIYI0ky6hE3s1M9lG2Q1HtwCRyNuWcVaMCJqys6aVjx21W6UyqF1PMfAMy gIWT7od/Gvs2Mryyt7YuvaekkfzY2qQoPU1dmDVs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , Paul Elder , Isaac Scott Subject: [PATCH v3 3/9] utils: gen-debug-controls: Improve log output Date: Mon, 7 Jul 2025 10:55:06 +0200 Message-ID: <20250707085520.39777-4-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250707085520.39777-1-stefan.klug@ideasonboard.com> References: <20250707085520.39777-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add log statements for found controls and the file written. This makes it easier to understand what happens under the hood. While at it, create nice colored log out put using coloredlogs if available. Signed-off-by: Stefan Klug Acked-by: Kieran Bingham Reviewed-by: Paul Elder Reviewed-by: Isaac Scott --- Changes in v3: - Collected tags Changes in v2: - Collected tag --- utils/gen-debug-controls.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/utils/gen-debug-controls.py b/utils/gen-debug-controls.py index ff22b986475e..a1c69bbd8294 100755 --- a/utils/gen-debug-controls.py +++ b/utils/gen-debug-controls.py @@ -17,8 +17,13 @@ import sys from dataclasses import dataclass from pathlib import Path -logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') +fmt = '%(levelname)s: %(message)s' +try: + import coloredlogs + coloredlogs.install(level=logging.INFO, fmt=fmt) +except ImportError: + logging.basicConfig(level=logging.INFO, format=fmt) + try: import ruamel.yaml as ruyaml @@ -27,6 +32,8 @@ except: f'Failed to import ruamel.yaml. Please install the ruamel.yaml package.') sys.exit(1) +logger = logging.getLogger(__name__) + @dataclass class FoundMatch: file: os.PathLike @@ -106,6 +113,7 @@ def main(argv): continue p = m.file.relative_to(root_dir) + logger.info(f"Found control {m.name} in {p}") desc = {'type': m.type, 'direction': 'out', 'description': f'Debug control {m.name} found in {p}'} @@ -165,6 +173,9 @@ def main(argv): "#\n")) yaml.dump(doc, f) + p = ctrl_file.relative_to(Path.cwd(), walk_up=True) + logger.info(f"Sucessfully updated {p}") + return 0