From nobody Mon Feb 9 03:46:32 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8600724503A; Mon, 24 Feb 2025 09:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388143; cv=none; b=GaRdVbf5On3Uic7TNHf2xvjK0iZQHfcejZUh5h7Xt8vN1bztPDPJ9dsw7WbBBBtF/De0E0qk2BZPJ+YP/yRHrS7sM9axBv9yQ7nLimXQLHn+dusf/X1ZfOJT4XtE8HEOPPmXWJxZ0gt0VDmuY3trF7IcSf/BHbp1WM9XMRiY+20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740388143; c=relaxed/simple; bh=lpGcciKaov3Y13LlsgFK4uZcLIWPLc8PIxEf/5bFm3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WifcTYk7jy6R478p9Gtg8nf1Ef/zwY8ycV5IKBKN9sItAg01GC25qSYQHN0eTVH7KfVbxTAs9Rs89wy/tCcHIlrPkFGCSfQILvIISy4ldhQOlwQ4fHnbwQwRTP5jHy0HZyaX99Td3tKbFIk4MEw66arZQWjmaeUbbxiHUS9rNVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S4XWhXqB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S4XWhXqB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCDC0C4CEF2; Mon, 24 Feb 2025 09:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740388142; bh=lpGcciKaov3Y13LlsgFK4uZcLIWPLc8PIxEf/5bFm3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S4XWhXqBtMDQRmkQZKsQMsdrXlQ+NW2QUaT7k+r0EqZ5kEZ/JkHuEq1jCCKFbN6SU xe1Xy+Sgdl61JrdQBliaqCk2KphAexH8x674UWQvpXIT7mwwz6t+D1P4o4RgQXnNCG XjIXYxcnjBTr2kiycyR0Irq0HXiyzqqECF1mT+vMHrpru5+D+9IEsoM1SozccMP3SV UvGl9g9ddwxCLbn4hkdOmIci91zxu1nsEBtj1wVSPuq6EUQY0M6FDrwH1QgUxr9nZ5 o53othZ0DRVaq55V9LPOk7q0ONClfaG1IUSfoWcZ5x7XMmCvTXpaA8o1/cMVXkUvGe FcOOLQWoWbF1Q== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tmUST-00000003p44-0GIa; Mon, 24 Feb 2025 10:09:01 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/39] scripts/kernel-doc.py: output warnings the same way as kerneldoc Date: Mon, 24 Feb 2025 10:08:16 +0100 Message-ID: <1ee48bdad5030aebe5c2442d805ac6ca922a86d1.1740387599.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Add a formatter to logging to produce outputs in a similar way to kernel-doc. This should help making it more compatible with existing scripts. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/kernel-doc.py b/scripts/kernel-doc.py index 5cf5ed63f215..8bc0470d3720 100755 --- a/scripts/kernel-doc.py +++ b/scripts/kernel-doc.py @@ -2640,6 +2640,11 @@ neither here nor at the original Perl script. """ =20 =20 +class MsgFormatter(logging.Formatter): + def format(self, record): + record.levelname =3D record.levelname.capitalize() + return logging.Formatter.format(self, record) + def main(): """Main program""" =20 @@ -2724,10 +2729,19 @@ def main(): args.wshort_desc =3D True args.wcontents_before_sections =3D True =20 + logger =3D logging.getLogger() + if not args.debug: - level =3D logging.INFO + logger.setLevel(logging.INFO) else: - level =3D logging.DEBUG + logger.setLevel(logging.DEBUG) + + formatter =3D MsgFormatter('%(levelname)s: %(message)s') + + handler =3D logging.StreamHandler() + handler.setFormatter(formatter) + + logger.addHandler(handler) =20 if args.man: out_style =3D ManFormat() @@ -2736,8 +2750,6 @@ def main(): else: out_style =3D RestFormat() =20 - logging.basicConfig(level=3Dlevel, format=3D"%(levelname)s: %(message)= s") - kfiles =3D KernelFiles(files=3Dargs.files, verbose=3Dargs.verbose, out_style=3Dout_style, werror=3Dargs.werror, wreturn=3Dargs.wreturn, wshort_desc=3Dargs.wshort= _desc, --=20 2.48.1