summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/kernellog.py
blob: 8ac7d274f542b78d9e6061b4f6900e309d817613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# SPDX-License-Identifier: GPL-2.0
#
# Sphinx has deprecated its older logging interface, but the replacement
# only goes back to 1.6.  So here's a wrapper layer to keep around for
# as long as we support 1.4.
#
import sphinx

if sphinx.__version__[:3] >= '1.6':
    UseLogging = True
    from sphinx.util import logging
    logger = logging.getLogger('kerneldoc')
else:
    UseLogging = False

def warn(app, message):
    if UseLogging:
        logger.warning(message)
    else:
        app.warn(message)

def verbose(app, message):
    if UseLogging:
        logger.verbose(message)
    else:
        app.verbose(message)

def info(app, message):
    if UseLogging:
        logger.info(message)
    else:
        app.info(message)