Skip to content

Commit

Permalink
unified log prints when activating/deactivating chains
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Jul 1, 2024
1 parent eef51cc commit 3c1f245
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions zetaclient/chains/base/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func NewObserver(

// Stop notifies all goroutines to stop and closes the database.
func (ob *Observer) Stop() {
ob.logger.Chain.Info().Msgf("observer is stopping for chain %d", ob.Chain().ChainId)
ob.logger.Chain.Info().Msgf("Observer is stopping for chain %d", ob.Chain().ChainId)
close(ob.stop)

// close database
Expand All @@ -140,7 +140,7 @@ func (ob *Observer) Stop() {
}
ob.db = nil
}
ob.Logger().Chain.Info().Msgf("observer stopped for chain %d", ob.Chain().ChainId)
ob.Logger().Chain.Info().Msgf("Observer stopped for chain %d", ob.Chain().ChainId)
}

// Chain returns the chain for the observer.
Expand Down
3 changes: 2 additions & 1 deletion zetaclient/chains/bitcoin/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (ob *Observer) Start() {
// TODO(revamp): move ticker related functions to a specific file
// TODO(revamp): move inner logic in a separate function
func (ob *Observer) WatchRPCStatus() {
ob.logger.Chain.Info().Msgf("RPCStatus is starting")
ob.logger.Chain.Info().Msgf("WatchRPCStatus started for chain %d", ob.Chain().ChainId)
ticker := time.NewTicker(60 * time.Second)

for {
Expand Down Expand Up @@ -267,6 +267,7 @@ func (ob *Observer) WatchRPCStatus() {
Msgf("[OK] RPC status check: latest block number %d, timestamp %s (%.fs ago), tss addr %s, #utxos: %d", bn, blockTime, elapsedSeconds, tssAddr, len(res))

case <-ob.StopChannel():
ob.Logger().Chain.Info().Msgf("WatchRPCStatus stopped for chain %d", ob.Chain().ChainId)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/evm/observer/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (ob *Observer) WatchOutbound() {
}
ticker.UpdateInterval(ob.GetChainParams().OutboundTicker, ob.Logger().Outbound)
case <-ob.StopChannel():
ob.Logger().Outbound.Info().Msgf("WatchOutbound: stopped for chain %d", ob.Chain().ChainId)
ob.Logger().Outbound.Info().Msgf("WatchOutbound stopped for chain %d", ob.Chain().ChainId)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (oc *Orchestrator) Start() {

// AwaitStopSignals waits for stop signals
func (oc *Orchestrator) AwaitStopSignals() {
oc.logger.Std.Info().Msgf("orchestrator awaiting the os.Interrupt, syscall.SIGTERM signals...")
oc.logger.Std.Info().Msgf("Orchestrator awaiting the os.Interrupt, syscall.SIGTERM signals...")

// subscribe to stop signals
ch := make(chan os.Signal, 1)
Expand All @@ -162,7 +162,7 @@ func (oc *Orchestrator) AwaitStopSignals() {

// stop orchestrator
oc.Stop()
oc.logger.Std.Info().Msgf("orchestrator stopped on signal: %s", sig)
oc.logger.Std.Info().Msgf("Orchestrator stopped on signal: %s", sig)
}

// Stop notifies all zetaclient goroutines to stop
Expand Down

0 comments on commit 3c1f245

Please sign in to comment.