kopia lustrzana https://github.com/bugout-dev/moonstream
Updated logs for middleware and status of nodes at node balancer
rodzic
de0ef49825
commit
d0ebd4782f
|
@ -113,7 +113,6 @@ func (bpool *BlockchainPool) GetNextNode(blockchain string) *Node {
|
|||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("Used node: %s with hi block: %d\n", np.Nodes[idx].GethURL, np.Nodes[idx].CurrentBlock)
|
||||
return np.Nodes[idx]
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +179,7 @@ func (bpool *BlockchainPool) HealthCheck() {
|
|||
n.SetCurrentBlock(statusResponse.CurrentBlock)
|
||||
}
|
||||
|
||||
log.Printf("Node %s is alive: %t with current block: %d\n", n.StatusURL, true, statusResponse.CurrentBlock)
|
||||
log.Printf("Node %s is alive: %t with current block: %d blockchain called: %d times\n", n.StatusURL, true, statusResponse.CurrentBlock, b.Current)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,5 +93,5 @@ func (cpool *ClientPool) CleanInactiveClientNodes() {
|
|||
}
|
||||
}
|
||||
|
||||
log.Printf("Active clients: %d", len(cpool.Clients))
|
||||
log.Printf("Active clients: %d\n", len(cpool.Clients))
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
humbug "github.com/bugout-dev/humbug/go/pkg"
|
||||
|
@ -31,6 +32,11 @@ func panicMiddleware(next http.Handler) http.Handler {
|
|||
func logMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
next.ServeHTTP(w, r)
|
||||
log.Printf("%s %s %s\n", r.Method, r.URL.Path, r.RemoteAddr)
|
||||
ip, _, err := net.SplitHostPort(r.RemoteAddr)
|
||||
if err != nil {
|
||||
log.Printf("Unable to parse client IP: %s\n", r.RemoteAddr)
|
||||
} else {
|
||||
log.Printf("%s %s %s\n", ip, r.Method, r.URL.Path)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue