本文整理匯總了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)
}