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