Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refactors logger to have ctx [Go Hack] #2841

Merged
merged 2 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/logger-ctx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Refactors logger to have ctx

This fixes the native library loggers which are not associated with the context and thus are not handled properly in the reva runtime.

https://github.com/cs3org/reva/pull/2841
4 changes: 3 additions & 1 deletion internal/http/services/archiver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"regexp"

"github.com/cs3org/reva/internal/http/services/archiver/manager"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
"github.com/cs3org/reva/pkg/rhttp"
Expand Down Expand Up @@ -209,6 +210,7 @@ func (s *svc) Handler() http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
// get the paths and/or the resources id from the query
ctx := r.Context()
log := appctx.GetLogger(ctx)
v := r.URL.Query()

paths, ok := v["path"]
Expand Down Expand Up @@ -244,7 +246,7 @@ func (s *svc) Handler() http.Handler {
archName += ".tar"
}

s.log.Debug().Msg("Requested the following files/folders to archive: " + render.Render(files))
log.Debug().Msg("Requested the following files/folders to archive: " + render.Render(files))

rw.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", archName))
rw.Header().Set("Content-Transfer-Encoding", "binary")
Expand Down