本文整理汇总了Golang中github.com/pivotal-golang/lager/lagertest.TestLogger.RegisterSink方法的典型用法代码示例。如果您正苦于以下问题:Golang TestLogger.RegisterSink方法的具体用法?Golang TestLogger.RegisterSink怎么用?Golang TestLogger.RegisterSink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pivotal-golang/lager/lagertest.TestLogger
的用法示例。
在下文中一共展示了TestLogger.RegisterSink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("TaskAuctionHandler", func() {
var (
logger *lagertest.TestLogger
runner *fake_auction_runner.FakeAuctionRunner
responseRecorder *httptest.ResponseRecorder
handler *auctionhandlers.TaskAuctionHandler
)
BeforeEach(func() {
logger = lagertest.NewTestLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))
runner = new(fake_auction_runner.FakeAuctionRunner)
responseRecorder = httptest.NewRecorder()
handler = auctionhandlers.NewTaskAuctionHandler(runner)
})
Describe("Create", func() {
Context("when the request body is a task", func() {
var tasks []*models.Task
BeforeEach(func() {
tasks = []*models.Task{{
TaskGuid: "the-task-guid",
Domain: "some-domain",
RootFs: "some:rootfs",
Action: models.WrapAction(&models.RunAction{
示例2:
)
var _ = Describe("TaskWorker", func() {
var (
fakeServer *ghttp.Server
logger *lagertest.TestLogger
timeout time.Duration
)
BeforeEach(func() {
timeout = 1 * time.Second
cf_http.Initialize(timeout)
fakeServer = ghttp.NewServer()
logger = lagertest.NewTestLogger("test")
logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.INFO))
})
AfterEach(func() {
fakeServer.Close()
})
Describe("HandleCompletedTask", func() {
var (
callbackURL string
taskDB *dbfakes.FakeTaskDB
statusCodes chan int
reqCount chan struct{}
task *models.Task
httpClient *http.Client