change logging for service startup

This commit is contained in:
Asim Aslam 2020-04-23 11:24:39 +01:00 committed by Vasiliy Tolstov
parent 655bf08aca
commit ac3ce1ec16

24
grpc.go
View File

@ -672,8 +672,8 @@ func (g *grpcServer) Register() error {
g.RUnlock()
if !registered {
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
}
}
@ -707,8 +707,8 @@ func (g *grpcServer) Register() error {
opts = append(opts, broker.DisableAutoAck())
}
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Subscribing to topic: %s", sb.Topic())
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Subscribing to topic: %s", sb.Topic())
}
sub, err := config.Broker.Subscribe(sb.Topic(), handler, opts...)
if err != nil {
@ -768,8 +768,8 @@ func (g *grpcServer) Deregister() error {
Nodes: []*registry.Node{node},
}
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Deregistering node: %s", node.Id)
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Deregistering node: %s", node.Id)
}
if err := config.Registry.Deregister(service); err != nil {
return err
@ -787,8 +787,8 @@ func (g *grpcServer) Deregister() error {
for sb, subs := range g.subscribers {
for _, sub := range subs {
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Unsubscribing from topic: %s", sub.Topic())
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Unsubscribing from topic: %s", sub.Topic())
}
sub.Unsubscribe()
}
@ -852,8 +852,8 @@ func (g *grpcServer) Start() error {
return err
}
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Broker [%s] Connected to %s", config.Broker.String(), config.Broker.Address())
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Broker [%s] Connected to %s", config.Broker.String(), config.Broker.Address())
}
}
@ -930,8 +930,8 @@ func (g *grpcServer) Start() error {
// close transport
ch <- nil
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
logger.Debugf("Broker [%s] Disconnected from %s", config.Broker.String(), config.Broker.Address())
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
logger.Infof("Broker [%s] Disconnected from %s", config.Broker.String(), config.Broker.Address())
}
// disconnect broker
if err := config.Broker.Disconnect(); err != nil {