change logging for service startup
This commit is contained in:
parent
6fa27373ed
commit
7345ce9192
@ -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 {
|
||||||
|
@ -630,8 +630,8 @@ func (s *rpcServer) Register() error {
|
|||||||
s.RUnlock()
|
s.RUnlock()
|
||||||
|
|
||||||
if !registered {
|
if !registered {
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
|
log.Infof("Registry [%s] Registering node: %s", config.Registry.String(), node.Id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,8 +684,8 @@ func (s *rpcServer) Register() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Subscribing to topic: %s", sub.Topic())
|
log.Infof("Subscribing to topic: %s", sub.Topic())
|
||||||
}
|
}
|
||||||
s.subscribers[sb] = []broker.Subscriber{sub}
|
s.subscribers[sb] = []broker.Subscriber{sub}
|
||||||
}
|
}
|
||||||
@ -745,8 +745,8 @@ func (s *rpcServer) Deregister() error {
|
|||||||
Nodes: []*registry.Node{node},
|
Nodes: []*registry.Node{node},
|
||||||
}
|
}
|
||||||
|
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Registry [%s] Deregistering node: %s", config.Registry.String(), node.Id)
|
log.Infof("Registry [%s] Deregistering node: %s", config.Registry.String(), node.Id)
|
||||||
}
|
}
|
||||||
if err := config.Registry.Deregister(service); err != nil {
|
if err := config.Registry.Deregister(service); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -770,8 +770,8 @@ func (s *rpcServer) Deregister() error {
|
|||||||
|
|
||||||
for sb, subs := range s.subscribers {
|
for sb, subs := range s.subscribers {
|
||||||
for _, sub := range subs {
|
for _, sub := range subs {
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Unsubscribing %s from topic: %s", node.Id, sub.Topic())
|
log.Infof("Unsubscribing %s from topic: %s", node.Id, sub.Topic())
|
||||||
}
|
}
|
||||||
sub.Unsubscribe()
|
sub.Unsubscribe()
|
||||||
}
|
}
|
||||||
@ -798,8 +798,8 @@ func (s *rpcServer) Start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Transport [%s] Listening on %s", config.Transport.String(), ts.Addr())
|
log.Infof("Transport [%s] Listening on %s", config.Transport.String(), ts.Addr())
|
||||||
}
|
}
|
||||||
|
|
||||||
// swap address
|
// swap address
|
||||||
@ -818,8 +818,8 @@ func (s *rpcServer) Start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Broker [%s] Connected to %s", bname, config.Broker.Address())
|
log.Infof("Broker [%s] Connected to %s", bname, config.Broker.Address())
|
||||||
}
|
}
|
||||||
|
|
||||||
// use RegisterCheck func before register
|
// use RegisterCheck func before register
|
||||||
@ -940,8 +940,8 @@ func (s *rpcServer) Start() error {
|
|||||||
// close transport listener
|
// close transport listener
|
||||||
ch <- ts.Close()
|
ch <- ts.Close()
|
||||||
|
|
||||||
if logger.V(logger.DebugLevel, logger.DefaultLogger) {
|
if logger.V(logger.InfoLevel, logger.DefaultLogger) {
|
||||||
log.Debugf("Broker [%s] Disconnected from %s", bname, config.Broker.Address())
|
log.Infof("Broker [%s] Disconnected from %s", bname, config.Broker.Address())
|
||||||
}
|
}
|
||||||
// disconnect the broker
|
// disconnect the broker
|
||||||
if err := config.Broker.Disconnect(); err != nil {
|
if err := config.Broker.Disconnect(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user