当前位置: 首页>>代码示例>>Golang>>正文


Golang TestLogger.RegisterSink方法代码示例

本文整理汇总了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{
开发者ID:Gerg,项目名称:bbs,代码行数:31,代码来源:task_auction_handler_test.go

示例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
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:taskcallback_test.go


注:本文中的github.com/pivotal-golang/lager/lagertest.TestLogger.RegisterSink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。