forked from TrueCloudLab/frostfs-node
[#240] logs: Move log messages to constants
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d29b13454f
commit
0e31c12e63
149 changed files with 1481 additions and 687 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"sort"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neorpc"
|
||||
|
@ -44,7 +45,7 @@ func (c *Client) switchRPC(ctx context.Context) bool {
|
|||
newEndpoint := c.endpoints.list[c.endpoints.curr].Address
|
||||
cli, act, err := c.newCli(ctx, newEndpoint)
|
||||
if err != nil {
|
||||
c.logger.Warn("could not establish connection to the switched RPC node",
|
||||
c.logger.Warn(logs.ClientCouldNotEstablishConnectionToTheSwitchedRPCNode,
|
||||
zap.String("endpoint", newEndpoint),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
@ -54,7 +55,7 @@ func (c *Client) switchRPC(ctx context.Context) bool {
|
|||
|
||||
c.cache.invalidate()
|
||||
|
||||
c.logger.Info("connection to the new RPC node has been established",
|
||||
c.logger.Info(logs.ClientConnectionToTheNewRPCNodeHasBeenEstablished,
|
||||
zap.String("endpoint", newEndpoint))
|
||||
|
||||
subs, ok := c.restoreSubscriptions(ctx, cli, newEndpoint, false)
|
||||
|
@ -147,7 +148,7 @@ func (c *Client) routeEvent(ctx context.Context, e any) {
|
|||
|
||||
func (c *Client) reconnect(ctx context.Context) bool {
|
||||
if closeErr := c.client.GetError(); closeErr != nil {
|
||||
c.logger.Warn("switching to the next RPC node",
|
||||
c.logger.Warn(logs.ClientSwitchingToTheNextRPCNode,
|
||||
zap.String("reason", closeErr.Error()),
|
||||
)
|
||||
} else {
|
||||
|
@ -158,7 +159,7 @@ func (c *Client) reconnect(ctx context.Context) bool {
|
|||
}
|
||||
|
||||
if !c.switchRPC(ctx) {
|
||||
c.logger.Error("could not establish connection to any RPC node")
|
||||
c.logger.Error(logs.ClientCouldNotEstablishConnectionToAnyRPCNode)
|
||||
|
||||
// could not connect to all endpoints =>
|
||||
// switch client to inactive mode
|
||||
|
@ -210,7 +211,7 @@ mainLoop:
|
|||
|
||||
cli, act, err := c.newCli(ctx, tryE)
|
||||
if err != nil {
|
||||
c.logger.Warn("could not create client to the higher priority node",
|
||||
c.logger.Warn(logs.ClientCouldNotCreateClientToTheHigherPriorityNode,
|
||||
zap.String("endpoint", tryE),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
@ -237,13 +238,13 @@ mainLoop:
|
|||
|
||||
c.switchLock.Unlock()
|
||||
|
||||
c.logger.Info("switched to the higher priority RPC",
|
||||
c.logger.Info(logs.ClientSwitchedToTheHigherPriorityRPC,
|
||||
zap.String("endpoint", tryE))
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
c.logger.Warn("could not restore side chain subscriptions using node",
|
||||
c.logger.Warn(logs.ClientCouldNotRestoreSideChainSubscriptionsUsingNode,
|
||||
zap.String("endpoint", tryE),
|
||||
zap.Error(err),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue