当前位置: 首页>>代码示例>>Python>>正文


Python logging.getLogger方法代码示例

本文整理汇总了Python中sphinx.util.logging.getLogger方法的典型用法代码示例。如果您正苦于以下问题:Python logging.getLogger方法的具体用法?Python logging.getLogger怎么用?Python logging.getLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sphinx.util.logging的用法示例。


在下文中一共展示了logging.getLogger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: configure_logging

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def configure_logging(app: "sphinx.application.Sphinx") -> None:
    """Configure Sphinx's WarningHandler to handle (expected) missing include."""
    import sphinx.util.logging
    import logging

    class WarnLogFilter(logging.Filter):
        def filter(self, record: logging.LogRecord) -> bool:
            """Ignore warnings about missing include with "only" directive.

            Ref: https://github.com/sphinx-doc/sphinx/issues/2150."""
            if (
                record.msg.startswith('Problems with "include" directive path:')
                and "_changelog_towncrier_draft.rst" in record.msg
            ):
                return False
            return True

    logger = logging.getLogger(sphinx.util.logging.NAMESPACE)
    warn_handler = [x for x in logger.handlers if x.level == logging.WARNING]
    assert len(warn_handler) == 1, warn_handler
    warn_handler[0].filters.insert(0, WarnLogFilter()) 
开发者ID:pytest-dev,项目名称:pytest,代码行数:23,代码来源:conf.py

示例2: __init__

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def __init__(self, *args, **kwargs):
        self._logger = logging.getLogger(__name__)  # requires Sphinx 1.6.1
        self._log_prefix = "conf.py/AutoAutoSummary"
        self._excluded_classes = ['BaseException']
        super(AutoAutoSummary, self).__init__(*args, **kwargs) 
开发者ID:zhmcclient,项目名称:python-zhmcclient,代码行数:7,代码来源:conf.py

示例3: finish

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def finish(self):
        log = logging.getLogger(__name__)
        needs = self.env.needs_all_needs
        filters = self.env.needs_all_filters
        config = self.env.config
        version = config.version
        needs_list = NeedsList(config, self.outdir, self.confdir)

        needs_list.load_json()

        # Clean needs_list from already stored needs of the current version.
        # This is needed as needs could have been removed from documentation and if this is the case,
        # removed needs would stay in needs_list, if list gets not cleaned.
        needs_list.wipe_version(version)

        for key, need in needs.items():
            needs_list.add_need(version, need)

        for key, need_filter in filters.items():
            if need_filter['export_id']:
                needs_list.add_filter(version, need_filter)

        try:
            needs_list.write_json()
        except Exception as e:
            log.error("Error during writing json file: {0}".format(e))
        else:
            log.info("Needs successfully exported") 
开发者ID:useblocks,项目名称:sphinxcontrib-needs,代码行数:30,代码来源:builder.py

示例4: __init__

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def __init__(self, *args, **kw):
        super(NeedDirective, self).__init__(*args, **kw)
        self.log = logging.getLogger(__name__)
        self.full_title = self._get_full_title() 
开发者ID:useblocks,项目名称:sphinxcontrib-needs,代码行数:6,代码来源:need.py

示例5: __init__

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def __init__(self, config, outdir, confdir):
        self.log = logging.getLogger(__name__)
        self.config = config
        self.outdir = outdir
        self.confdir = confdir
        self.current_version = config.version
        self.project = config.project
        self.needs_list = {
            "project": self.project,
            "current_version": self.current_version,
            "created": "",
            "versions": {}} 
开发者ID:useblocks,项目名称:sphinxcontrib-needs,代码行数:14,代码来源:utils.py

示例6: build_includes

# 需要导入模块: from sphinx.util import logging [as 别名]
# 或者: from sphinx.util.logging import getLogger [as 别名]
def build_includes(app):
    """Build extra include files from _includes dir
    """
    logger = logging.getLogger('includes')
    curdir = os.path.abspath(os.path.dirname(__file__))
    incdir = os.path.join(curdir, '_includes')
    for pyf in glob.glob(os.path.join(curdir, '_includes', '*.py')):
        rstfile = pyf.replace('.py', '.rst')
        logger.info('generating {0} from {1}'.format(rstfile, pyf))
        rst = subprocess.check_output([sys.executable, pyf])
        with open(rstfile, 'w') as f:
            f.write(rst)


# -- setup -------------------------------------------------------------------- 
开发者ID:gwastro,项目名称:gwin,代码行数:17,代码来源:conf.py


注:本文中的sphinx.util.logging.getLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。