本文整理汇总了Python中opbeat.base.Client.build_msg_for_logging方法的典型用法代码示例。如果您正苦于以下问题:Python Client.build_msg_for_logging方法的具体用法?Python Client.build_msg_for_logging怎么用?Python Client.build_msg_for_logging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opbeat.base.Client
的用法示例。
在下文中一共展示了Client.build_msg_for_logging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_build_then_send
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import build_msg_for_logging [as 别名]
def test_build_then_send(self):
organization_id = "organization_id"
app_id = "app_id"
secret_token = "secret_token"
try:
Client.register_scheme('mock', DummyScheme)
except:
pass
c = Client(organization_id=organization_id, secret_token=secret_token,
app_id=app_id, hostname="test_server")
mydate = datetime.datetime(2012, 5, 4, tzinfo=pytz.utc)
d = calendar.timegm(mydate.timetuple())
msg = c.build_msg_for_logging("Message", message='foo', date=d)
expected = {
'organization_id': organization_id,
'app_id': app_id,
'secret_token': secret_token,
'message': 'foo',
'param_message': {'message': 'foo', 'params': ()},
'machine': {'hostname': u'test_server'},
'level': "error",
'extra': {},
'timestamp': 1336089600
}
# The client_supplied_id is always overridden
del msg['client_supplied_id']
self.assertEquals(msg, expected)