Move stream to interface

This commit is contained in:
Asim Aslam
2019-12-17 16:56:55 +00:00
parent 91e057440d
commit d2a3fd0b04
11 changed files with 269 additions and 217 deletions

25
debug/service/stream.go Normal file
View File

@@ -0,0 +1,25 @@
package service
import (
"github.com/micro/go-micro/debug/log"
)
type logStream struct {
stream chan log.Record
stop chan bool
}
func (l *logStream) Chan() <-chan log.Record {
return l.stream
}
func (l *logStream) Stop() error {
select {
case <-l.stop:
return nil
default:
close(l.stream)
close(l.stop)
}
return nil
}