本文整理汇总了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))
示例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
示例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))
示例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))