[#1437] node: Use ctx for logging

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-21 10:22:54 +03:00
parent c16dae8b4d
commit 6db46257c0
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
157 changed files with 764 additions and 713 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"context"
"net/http"
"time"
@ -25,7 +26,7 @@ const (
)
func (c *httpComponent) init() {
log.Info("init " + c.name)
log.Info(context.Background(), "init "+c.name)
c.enabled = cfg.GetBool(c.name + enabledKeyPostfix)
c.address = cfg.GetString(c.name + addressKeyPostfix)
c.shutdownDur = cfg.GetDuration(c.name + shutdownTimeoutKeyPostfix)
@ -39,14 +40,14 @@ func (c *httpComponent) init() {
httputil.WithShutdownTimeout(c.shutdownDur),
)
} else {
log.Info(c.name + " is disabled, skip")
log.Info(context.Background(), c.name+" is disabled, skip")
c.srv = nil
}
}
func (c *httpComponent) start() {
if c.srv != nil {
log.Info("start " + c.name)
log.Info(context.Background(), "start "+c.name)
wg.Add(1)
go func() {
defer wg.Done()
@ -57,7 +58,7 @@ func (c *httpComponent) start() {
func (c *httpComponent) shutdown() error {
if c.srv != nil {
log.Info("shutdown " + c.name)
log.Info(context.Background(), "shutdown "+c.name)
return c.srv.Shutdown()
}
return nil
@ -71,11 +72,11 @@ func (c *httpComponent) needReload() bool {
}
func (c *httpComponent) reload() {
log.Info("reload " + c.name)
log.Info(context.Background(), "reload "+c.name)
if c.needReload() {
log.Info(c.name + " config updated")
log.Info(context.Background(), c.name+" config updated")
if err := c.shutdown(); err != nil {
log.Debug(logs.FrostFSIRCouldNotShutdownHTTPServer,
log.Debug(context.Background(), logs.FrostFSIRCouldNotShutdownHTTPServer,
zap.String("error", err.Error()),
)
} else {