本文整理汇总了Golang中doppler/sinkserver/sinkmanager.SinkManager.UnregisterSink方法的典型用法代码示例。如果您正苦于以下问题:Golang SinkManager.UnregisterSink方法的具体用法?Golang SinkManager.UnregisterSink怎么用?Golang SinkManager.UnregisterSink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类doppler/sinkserver/sinkmanager.SinkManager
的用法示例。
在下文中一共展示了SinkManager.UnregisterSink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
BeforeEach(func() {
dumpSink = dump.NewDumpSink("appId", 1, loggertesthelper.Logger(), time.Hour)
sinkManager.RegisterSink(dumpSink)
})
It("clears the recent logs buffer", func() {
expectedMessageString := "Some Data"
expectedMessage, _ := emitter.Wrap(factories.NewLogMessage(events.LogMessage_OUT, expectedMessageString, "myApp", "App"), "origin")
sinkManager.SendTo("appId", expectedMessage)
Eventually(func() []*events.Envelope {
return sinkManager.RecentLogsFor("appId")
}).Should(HaveLen(1))
sinkManager.UnregisterSink(dumpSink)
Eventually(func() []*events.Envelope {
return sinkManager.RecentLogsFor("appId")
}).Should(HaveLen(0))
})
})
Context("with a SyslogSink", func() {
var syslogSink sinks.Sink
BeforeEach(func() {
url := &url.URL{Scheme: "syslog", Host: "localhost:9998"}
writer, _ := syslogwriter.NewSyslogWriter(url, "appId", &net.Dialer{Timeout: 500 * time.Millisecond}, 0)
syslogSink = syslog.NewSyslogSink("appId", url, loggertesthelper.Logger(), 100, writer, func(string, string) {}, "dropsonde-origin")