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


Python raven.fetch_package_version方法代码示例

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


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

示例1: sentrytest

# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def sentrytest(self):
        """return true if we managed to send a sample raven exception"""
        if not (self.config.sentry and self.config.sentry.dsn):
            raise SentryConfigurationError('sentry dsn not configured')

        try:
            version = raven.fetch_package_version('crontabber')
        except Exception:
            version = None
            self.config.logger.warning(
                'Unable to extract version of crontabber',
                exc_info=True
            )
        client = raven.Client(
            dsn=self.config.sentry.dsn,
            release=version
        )
        identifier = client.captureMessage(
            'Sentry test sent from crontabber'
        )
        self.config.logger.info(
            'Sentry successful identifier: %s', identifier
        )
        return True 
开发者ID:mozilla,项目名称:crontabber,代码行数:26,代码来源:app.py

示例2: __init__

# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def __init__(self, logger_name, log_level="debug", log_format="json",
                 log_output="stdout", sentry_dsn=None,
                 firehose_delivery_stream=None):
        self.logger_name = "-".join([
            logger_name,
            pkg_resources.get_distribution("autopush").version
        ])
        self._filename = None
        self.log_level = LogLevel.lookupByName(log_level)
        if log_output == "stdout":
            self._output = sys.stdout
        elif log_output == "none":
            self._output = None
        else:
            self._filename = log_output
            self._output = None
        if log_format == "json":
            self.format_event = self.json_format
        else:
            self.format_event = formatEventAsClassicLogText
        if sentry_dsn:
            self.raven_client = raven.Client(
                release=raven.fetch_package_version("autopush"),
                transport=TwistedHTTPTransport,
                enable_breadcrumbs=False,
            )
        else:
            self.raven_client = None
        if firehose_delivery_stream:
            self.firehose = FirehoseProcessor(
                stream_name=firehose_delivery_stream)
        else:
            self.firehose = None 
开发者ID:mozilla-services,项目名称:autopush,代码行数:35,代码来源:logging.py

示例3: setup_sentry

# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def setup_sentry(name, channel, dsn):
    """
    Setup sentry account using taskcluster secrets
    """

    # Detect environment
    task_id = os.environ.get("TASK_ID")
    if task_id is not None:
        site = "taskcluster"
    elif "DYNO" in os.environ:
        site = "heroku"
    else:
        site = "unknown"

    sentry_client = raven.Client(
        dsn=dsn,
        site=site,
        name=name,
        environment=channel,
        release=raven.fetch_package_version(f"code-coverage-{name}"),
    )

    if task_id is not None:
        # Add a Taskcluster task id when available
        # It will be shown in the Additional Data section on the dashboard
        sentry_client.context.merge({"extra": {"task_id": task_id}})

    sentry_handler = raven.handlers.logbook.SentryHandler(
        sentry_client, level=logbook.WARNING, bubble=True
    )
    sentry_handler.push_application() 
开发者ID:mozilla,项目名称:code-coverage,代码行数:33,代码来源:log.py

示例4: setup_sentry

# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def setup_sentry(name, channel, dsn):
    """
    Setup sentry account using taskcluster secrets
    """

    # Detect environment
    task_id = os.environ.get("TASK_ID")
    if task_id is not None:
        site = "taskcluster"
    elif "DYNO" in os.environ:
        site = "heroku"
    else:
        site = "unknown"

    sentry_client = raven.Client(
        dsn=dsn,
        site=site,
        name=name,
        environment=channel,
        release=raven.fetch_package_version(f"code-review-{name}"),
    )

    if task_id is not None:
        # Add a Taskcluster task id when available
        # It will be shown in the Additional Data section on the dashboard
        sentry_client.context.merge({"extra": {"task_id": task_id}})

    sentry_handler = raven.handlers.logbook.SentryHandler(
        sentry_client, level=logbook.WARNING, bubble=True
    )
    sentry_handler.push_application() 
开发者ID:mozilla,项目名称:code-review,代码行数:33,代码来源:log.py


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