From patchwork Fri Apr 11 12:36:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 23160 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 A0607C327D for ; Fri, 11 Apr 2025 12:36:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5155F68A90; Fri, 11 Apr 2025 14:36:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IJfe5QhW"; 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 14A3668A90 for ; Fri, 11 Apr 2025 14:36:55 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:5b21:2ad5:1023:7179]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BEF6A7F5; Fri, 11 Apr 2025 14:34:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1744374895; bh=4JeMJBu26vCvazvklZn3yQgB0jc9civdYO4PGrUlA1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJfe5QhWNW7GcX0AhSklEvyvNPVJQv8iBdAb4E2VvIfOqVAGhO8d5KMJveEFF4Tmc BXQ+n8HjFfHecPqXJwG93WdNrceq/AFUggZCTtsOEiJoB6qKtpzWy9PAcdqPopcxxX 2CrdjD8WkpJPxpYNxqKEihTdt1fIFqRA+QgFZTlo= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham Subject: [PATCH v2 3/9] utils: gen-debug-controls: Improve log output Date: Fri, 11 Apr 2025 14:36:31 +0200 Message-ID: <20250411123641.2144530-4-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411123641.2144530-1-stefan.klug@ideasonboard.com> References: <20250411123641.2144530-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 --- 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