當前位置: 首頁>>代碼示例>>Golang>>正文


Golang GroupedSinks.DumpFor方法代碼示例

本文整理匯總了Golang中loggregator/groupedsinks.GroupedSinks.DumpFor方法的典型用法代碼示例。如果您正苦於以下問題:Golang GroupedSinks.DumpFor方法的具體用法?Golang GroupedSinks.DumpFor怎麽用?Golang GroupedSinks.DumpFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在loggregator/groupedsinks.GroupedSinks的用法示例。


在下文中一共展示了GroupedSinks.DumpFor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: dumpToSink

func (messageRouter *messageRouter) dumpToSink(sink sinks.Sink, activeSinks *groupedsinks.GroupedSinks) {
	dumpChan := make(chan *logmessage.Message, 20)
	if sink := activeSinks.DumpFor(sink.AppId()); sink != nil {
		sink.Dump(dumpChan)
	} else {
		close(dumpChan)
	}
	for message := range dumpChan {
		sink.Channel() <- message
	}
}
開發者ID:uabassguy,項目名稱:loggregator,代碼行數:11,代碼來源:message_router.go

示例2: manageDumps

func (messageRouter *messageRouter) manageDumps(activeSinks *groupedsinks.GroupedSinks, appId string) {
	if activeSinks.DumpFor(appId) == nil {
		s := sinks.NewDumpSink(appId, messageRouter.dumpBufferSize, messageRouter.logger)

		ok := messageRouter.registerSink(s, activeSinks)

		if ok {
			go s.Run()
		}
	}
}
開發者ID:uabassguy,項目名稱:loggregator,代碼行數:11,代碼來源:message_router.go

示例3:

		})
	})

	Describe("DumpFor", func() {
		It("should return only dumps", func() {
			target := "789"

			sink1 := syslog.NewSyslogSink(target, "url1", loggertesthelper.Logger(), DummySyslogWriter{}, errorChan)
			sink2 := syslog.NewSyslogSink(target, "url2", loggertesthelper.Logger(), DummySyslogWriter{}, errorChan)
			sink3 := dump.NewDumpSink(target, 5, loggertesthelper.Logger(), time.Second, fakeTimeProvider)

			groupedSinks.Register(inputChan, sink1)
			groupedSinks.Register(inputChan, sink2)
			groupedSinks.Register(inputChan, sink3)

			Expect(groupedSinks.DumpFor(target)).To(Equal(sink3))
		})

		It("should return only dumps that match the appId", func() {
			target := "789"
			otherTarget := "790"

			sink1 := dump.NewDumpSink(target, 5, loggertesthelper.Logger(), time.Second, fakeTimeProvider)
			sink2 := dump.NewDumpSink(otherTarget, 5, loggertesthelper.Logger(), time.Second, fakeTimeProvider)

			groupedSinks.Register(inputChan, sink1)
			groupedSinks.Register(inputChan, sink2)

			Expect(groupedSinks.DumpFor(target)).To(Equal(sink1))
		})
開發者ID:nkuacac,項目名稱:loggregator,代碼行數:30,代碼來源:grouped_sinks_test.go


注:本文中的loggregator/groupedsinks.GroupedSinks.DumpFor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。