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


Python LOG.error方法代码示例

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


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

示例1: node_apply_end

# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import error [as 别名]
def node_apply_end(repo, node, duration=None, interactive=None, result=None, **kwargs):
    if environ.get('TERM_PROGRAM', None) != "iTerm.app" or not interactive:
        LOG.debug("skipping iTerm stats (wrong terminal)")
        return

    if not IMPORTS:
        LOG.error("failed to import dependencies of itermstats plugin")
        return

    css_file = NamedTemporaryFile(delete=False)
    css_file.write(".text-overlay { display: none; }")
    css_file.close()

    config = Config(
        height=150,
        style=STYLE,
        width=350,
    )
    config.css.append(css_file.name)

    chart = Pie(config)
    chart.add('correct', result.correct)
    chart.add('fixed', result.fixed)
    chart.add('skipped', result.skipped)
    chart.add('failed', result.failed)

    png_data = cairosvg.svg2png(bytestring=chart.render())
    png_data_b64 = b64encode(png_data)

    remove(css_file.name)

    print("\033]1337;File=inline=1:{}\007".format(png_data_b64))
开发者ID:bundlewrap,项目名称:plugins,代码行数:34,代码来源:itermstats.py

示例2: _get_config

# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import error [as 别名]
def _get_config(repo_path):
    config_path = join(repo_path, ".slack.cfg")
    if not exists(config_path):
        _create_config(config_path)
    config = SafeConfigParser()
    config.read(config_path)
    if config.get("configuration", "enabled") == "unconfigured":
        LOG.error("Slack notifications not configured. Please edit .slack.cfg "
                  "(it has already been created) and set enabled to 'yes' "
                  "(or 'no' to silence this message and disable Slack notifications).")
        return None
    elif config.get("configuration", "enabled").lower() not in ("yes", "true", "1"):
        LOG.debug("Slack notifications not enabled in .slack.cfg, skipping...")
        return None
    elif not REQUESTS:
        LOG.error("Slack notifications need the requests library. "
                  "You can usually install it with `pip install requests`.")
        return None
    return config
开发者ID:rhazdon,项目名称:plugins,代码行数:21,代码来源:notify_slack.py

示例3: _notify

# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import error [as 别名]
def _notify(server, room, token, message, message_format, color="gray"):
    try:
        post(
            "https://{server}/v2/room/{room}/notification?auth_token={token}".format(
                token=token,
                room=room,
                server=server,
            ),
            headers={
                'content-type': 'application/json',
            },
            data=dumps({
                'color': color,
                'message': message,
                'message_format': message_format,
                'notify': True,
            }),
        )
    except ConnectionError as e:
        LOG.error("Failed to submit HipChat notification: {}".format(e))
开发者ID:bundlewrap,项目名称:plugins,代码行数:22,代码来源:notify_hipchat.py

示例4: _notify

# 需要导入模块: from bundlewrap.utils import LOG [as 别名]
# 或者: from bundlewrap.utils.LOG import error [as 别名]
def _notify(url, message=None, title=None, fallback=None, user=None, target=None, color="#000000"):
    payload = {
        "icon_url": "http://bundlewrap.org/img/icon.png",
        "username": "bundlewrap",
    }
    if fallback:
        payload["attachments"] = [{
            "color": color,
            "fallback": fallback,
        }]
        if message:
            payload["attachments"][0]["text"] = message
        if title:
            payload["attachments"][0]["title"] = title
        if target and user:
            payload["attachments"][0]["fields"] = [
                {
                    "short": True,
                    "title": "User",
                    "value": user,
                },
                {
                    "short": True,
                    "title": "Target",
                    "value": target,
                },
            ]
    else:
        payload["text"] = message

    try:
        post(
            url,
            headers={
                'content-type': 'application/json',
            },
            data=dumps(payload),
        )
    except ConnectionError as e:
        LOG.error("Failed to submit Slack notification: {}".format(e))
开发者ID:rhazdon,项目名称:plugins,代码行数:42,代码来源:notify_slack.py


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