forked from TrueCloudLab/frostfs-node
[#1930] services/session: Log calling Create
RPC
There is a need to check if session is opened during system testing/debug. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
8bba490c30
commit
7b418c36b4
3 changed files with 13 additions and 4 deletions
|
@ -5,6 +5,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type ServiceExecutor interface {
|
||||
|
@ -13,16 +15,24 @@ type ServiceExecutor interface {
|
|||
|
||||
type executorSvc struct {
|
||||
exec ServiceExecutor
|
||||
|
||||
log *logger.Logger
|
||||
}
|
||||
|
||||
// NewExecutionService wraps ServiceExecutor and returns Session Service interface.
|
||||
func NewExecutionService(exec ServiceExecutor) Server {
|
||||
func NewExecutionService(exec ServiceExecutor, l *logger.Logger) Server {
|
||||
return &executorSvc{
|
||||
exec: exec,
|
||||
log: l,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*session.CreateResponse, error) {
|
||||
s.log.Debug("serving request...",
|
||||
zap.String("component", "SessionService"),
|
||||
zap.String("request", "Create"),
|
||||
)
|
||||
|
||||
respBody, err := s.exec.Create(ctx, req.GetBody())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not execute Create request: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue