本文整理汇总了Golang中github.com/tsuru/tsuru/app.App.Log方法的典型用法代码示例。如果您正苦于以下问题:Golang App.Log方法的具体用法?Golang App.Log怎么用?Golang App.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/app.App
的用法示例。
在下文中一共展示了App.Log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestLogRemoveByApp
func (s *LogSuite) TestLogRemoveByApp(c *check.C) {
a := app.App{
Name: "words",
Teams: []string{s.team.Name},
}
err := s.conn.Apps().Insert(a)
c.Assert(err, check.IsNil)
defer s.conn.Apps().Remove(bson.M{"name": a.Name})
err = a.Log("last log msg", "tsuru", "")
c.Assert(err, check.IsNil)
a2 := app.App{Name: "words2"}
err = s.conn.Apps().Insert(a2)
c.Assert(err, check.IsNil)
defer s.conn.Apps().Remove(bson.M{"name": a2.Name})
err = a2.Log("last log msg2", "tsuru", "")
c.Assert(err, check.IsNil)
url := fmt.Sprintf("/logs?app=%s", a.Name)
request, err := http.NewRequest("DELETE", url, nil)
c.Assert(err, check.IsNil)
recorder := httptest.NewRecorder()
err = logRemove(recorder, request, s.token)
c.Assert(err, check.IsNil)
count, err := s.logConn.Logs(a2.Name).Find(nil).Count()
c.Assert(err, check.IsNil)
c.Assert(count, check.Equals, 1)
}
示例2: TestLogRemoveAll
func (s *LogSuite) TestLogRemoveAll(c *check.C) {
a := app.App{Name: "words"}
request, err := http.NewRequest("DELETE", "/logs", nil)
c.Assert(err, check.IsNil)
recorder := httptest.NewRecorder()
err = s.conn.Apps().Insert(a)
c.Assert(err, check.IsNil)
defer s.conn.Apps().Remove(bson.M{"name": a.Name})
err = a.Log("last log msg", "tsuru", "")
c.Assert(err, check.IsNil)
err = logRemove(recorder, request, s.token)
c.Assert(err, check.IsNil)
count, err := s.logConn.Logs(a.Name).Find(nil).Count()
c.Assert(err, check.IsNil)
c.Assert(count, check.Equals, 0)
}