2019-12-17 19:56:55 +03:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2020-01-30 14:39:00 +03:00
|
|
|
"github.com/micro/go-micro/v2/debug/log"
|
2019-12-17 19:56:55 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|