Re: [PATCH 4/8] doc: kernel_feat.py: convert to sphinx.util.logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Mon,  5 Feb 2024 18:51:29 +0100
Vegard Nossum <vegard.nossum@xxxxxxxxxx> escreveu:

> As of commit 3e893e16af55 ("docs: Raise the minimum Sphinx requirement
> to 2.4.4"), we can use Sphinx's built-in logging facilities.
> 
> Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
> ---
>  Documentation/sphinx/kernel_feat.py | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
> index 3493621d1a4e..f1c9e4a54964 100644
> --- a/Documentation/sphinx/kernel_feat.py
> +++ b/Documentation/sphinx/kernel_feat.py
> @@ -41,10 +41,13 @@ from docutils import nodes, statemachine
>  from docutils.statemachine import ViewList
>  from docutils.parsers.rst import directives, Directive
>  from docutils.utils.error_reporting import ErrorString
> +from sphinx.util import logging
>  from sphinx.util.docutils import switch_source_input
>  
>  __version__  = '1.0'
>  
> +logger = logging.getLogger(__name__)
> +
>  def setup(app):
>  
>      app.add_directive("kernel-feat", KernelFeat)
> @@ -67,12 +70,6 @@ class KernelFeat(Directive):
>          "debug"     : directives.flag
>      }
>  
> -    def warn(self, message, **replace):
> -        replace["fname"]   = self.state.document.current_source
> -        replace["line_no"] = replace.get("line_no", self.lineno)
> -        message = ("%(fname)s:%(line_no)s: [kernel-feat WARN] : " + message) % replace
> -        self.state.document.settings.env.app.warn(message, prefix="")
> -

That doesn't sound right.

If you remove the logic which gets the actual file name and line where
the error/warning have occurred, how are you handing now the special
output with such data produced by get_abi.pl to return the real file
name/line number where the error occurred?

Had you test changing an ABI file to cause a Sphinx warning and
ensured that the produced warning will report the actual location
of the warning, instead of shooting the messenger?

>      def run(self):
>          doc = self.state.document
>          if not doc.settings.file_insertion_enabled:

Thanks,
Mauro




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux