Skip to content

Commit

Permalink
Get the logger in the grpcMDResponseToFileInfo func
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Furano committed Nov 2, 2023
1 parent 0d580e5 commit 409b0f9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/eosclient/eosgrpc/eosgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (c *Client) GetFileInfoByInode(ctx context.Context, auth eosclient.Authoriz

log.Debug().Uint64("inode", inode).Str("rsp:", fmt.Sprintf("%#v", rsp)).Msg("grpc response")

info, err := c.grpcMDResponseToFileInfo(rsp)
info, err := c.grpcMDResponseToFileInfo(ctx, rsp)
if err != nil {
return nil, err
}
Expand All @@ -482,7 +482,7 @@ func (c *Client) GetFileInfoByInode(ctx context.Context, auth eosclient.Authoriz
info.Inode = inode
}

log.Debug().Str("func", "GetFileInfoByInode").Uint64("inode", inode).Msg("")
log.Debug().Str("func", "GetFileInfoByInode").Uint64("inode", inode).Uint64("info.Inode", info.Inode).Uint64("size", info.Size).Str("etag", info.Etag).Msg("")
return c.fixupACLs(ctx, auth, info), nil
}

Expand Down Expand Up @@ -699,7 +699,7 @@ func (c *Client) GetFileInfoByPath(ctx context.Context, auth eosclient.Authoriza

log.Debug().Str("func", "GetFileInfoByPath").Str("path", path).Str("rsp:", fmt.Sprintf("%#v", rsp)).Msg("grpc response")

info, err := c.grpcMDResponseToFileInfo(rsp)
info, err := c.grpcMDResponseToFileInfo(ctx, rsp)
if err != nil {
return nil, err
}
Expand All @@ -712,6 +712,7 @@ func (c *Client) GetFileInfoByPath(ctx context.Context, auth eosclient.Authoriza
info.Inode = inode
}

log.Debug().Str("func", "GetFileInfoByPath").Str("path", path).Uint64("info.Inode", info.Inode).Uint64("size", info.Size).Str("etag", info.Etag).Msg("")
return c.fixupACLs(ctx, auth, info), nil
}

Expand Down Expand Up @@ -1202,7 +1203,7 @@ func (c *Client) List(ctx context.Context, auth eosclient.Authorization, dpath s

log.Debug().Str("func", "List").Str("path", dpath).Str("item resp:", fmt.Sprintf("%#v", rsp)).Msg("grpc response")

myitem, err := c.grpcMDResponseToFileInfo(rsp)
myitem, err := c.grpcMDResponseToFileInfo(ctx, rsp)
if err != nil {
log.Error().Err(err).Str("func", "List").Str("path", dpath).Str("could not convert item:", fmt.Sprintf("%#v", rsp)).Str("err", err.Error()).Msg("")

Expand Down Expand Up @@ -1572,7 +1573,7 @@ func getFileFromVersionFolder(p string) string {
return path.Join(path.Dir(p), strings.TrimPrefix(path.Base(p), versionPrefix))
}

func (c *Client) grpcMDResponseToFileInfo(st *erpc.MDResponse) (*eosclient.FileInfo, error) {
func (c *Client) grpcMDResponseToFileInfo(ctx context.Context, st *erpc.MDResponse) (*eosclient.FileInfo, error) {
if st.Cmd == nil && st.Fmd == nil {
return nil, errors.Wrap(errtypes.NotSupported(""), "Invalid response (st.Cmd and st.Fmd are nil)")
}
Expand Down

0 comments on commit 409b0f9

Please sign in to comment.