2021-01-13 08:11:44 +03:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2021-10-28 00:36:45 +03:00
|
|
|
"go.unistack.org/micro/v3/client"
|
|
|
|
"go.unistack.org/micro/v3/logger"
|
|
|
|
"go.unistack.org/micro/v3/store"
|
2021-01-13 08:11:44 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type clientKey struct{}
|
|
|
|
|
|
|
|
// Client to call logger service
|
|
|
|
func Client(c client.Client) logger.Option {
|
|
|
|
return logger.SetOption(clientKey{}, c)
|
|
|
|
}
|
|
|
|
|
|
|
|
type storeKey struct{}
|
|
|
|
|
|
|
|
// Store to hold messages while logger service is unavailable
|
|
|
|
func Store(s store.Store) logger.Option {
|
|
|
|
return logger.SetOption(storeKey{}, s)
|
|
|
|
}
|
2021-01-19 21:56:26 +03:00
|
|
|
|
|
|
|
type serviceKey struct{}
|
|
|
|
|
|
|
|
// Service name to call logger service
|
|
|
|
func Service(n string) logger.Option {
|
|
|
|
return logger.SetOption(serviceKey{}, n)
|
|
|
|
}
|