當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。