Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-10-10 10:13:44 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-10-10 10:13:44 +0300
commit91de94de1c498d03439e5c5bd79dcb12c7ad08b4 (patch)
tree605a34655333e56ed929c39328bdafbeabf5b721 /cmd
parent5abfbdbb2daf391e1691dd82f4645adaccd66b07 (diff)
command: Replace use of ctxlogrus with injected logger
The ctxlogrus package is going away with the replacement being log fields extracted from the context via `log.DebugContext()` et al. Refactor the code to stop using ctxlogrus by injecting a logger and using the new context-based logging methods.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly-debug/bitmap.go17
-rw-r--r--cmd/gitaly-debug/main.go12
-rw-r--r--cmd/gitaly-lfs-smudge/main_test.go2
3 files changed, 18 insertions, 13 deletions
diff --git a/cmd/gitaly-debug/bitmap.go b/cmd/gitaly-debug/bitmap.go
index b90840ce2..8d6f89f4d 100644
--- a/cmd/gitaly-debug/bitmap.go
+++ b/cmd/gitaly-debug/bitmap.go
@@ -6,10 +6,11 @@ import (
"os"
"gitlab.com/gitlab-org/gitaly/v16/internal/git/packfile"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/log"
)
-func listBitmapPack(idxFile string) {
- idx, err := packfile.ReadIndex(idxFile)
+func listBitmapPack(logger log.Logger, idxFile string) {
+ idx, err := packfile.ReadIndex(logger, idxFile)
noError(err)
noError(idx.LabelObjectTypes())
@@ -23,8 +24,8 @@ func listBitmapPack(idxFile string) {
}
}
-func mapBitmapPack(idxFile string) {
- idx, err := packfile.ReadIndex(idxFile)
+func mapBitmapPack(logger log.Logger, idxFile string) {
+ idx, err := packfile.ReadIndex(logger, idxFile)
noError(err)
noError(idx.LabelObjectTypes())
@@ -52,8 +53,8 @@ func mapBitmapPack(idxFile string) {
}
}
-func listBitmapCommits(idxFile string) {
- idx, err := packfile.ReadIndex(idxFile)
+func listBitmapCommits(logger log.Logger, idxFile string) {
+ idx, err := packfile.ReadIndex(logger, idxFile)
noError(err)
noError(idx.LabelObjectTypes())
@@ -69,8 +70,8 @@ func listBitmapCommits(idxFile string) {
}
}
-func listBitmapReachable(idxFile string, commitID string) {
- idx, err := packfile.ReadIndex(idxFile)
+func listBitmapReachable(logger log.Logger, idxFile string, commitID string) {
+ idx, err := packfile.ReadIndex(logger, idxFile)
noError(err)
noError(idx.LabelObjectTypes())
diff --git a/cmd/gitaly-debug/main.go b/cmd/gitaly-debug/main.go
index 8f850173c..2d0d9e236 100644
--- a/cmd/gitaly-debug/main.go
+++ b/cmd/gitaly-debug/main.go
@@ -4,6 +4,8 @@ import (
"fmt"
"io"
"os"
+
+ "gitlab.com/gitlab-org/gitaly/v16/internal/log"
)
const (
@@ -39,6 +41,8 @@ list-bitmap-reachable IDX_FILE BITMAP_COMMIT_ID
)
func main() {
+ logger := log.ConfigureCommand()
+
if len(os.Args) < 2 {
fatal(usage)
}
@@ -59,22 +63,22 @@ func main() {
if len(extraArgs) != 1 {
fatal(usage)
}
- listBitmapPack(extraArgs[0])
+ listBitmapPack(logger, extraArgs[0])
case "map-bitmap-pack":
if len(extraArgs) != 1 {
fatal(usage)
}
- mapBitmapPack(extraArgs[0])
+ mapBitmapPack(logger, extraArgs[0])
case "list-bitmap-commits":
if len(extraArgs) != 1 {
fatal(usage)
}
- listBitmapCommits(extraArgs[0])
+ listBitmapCommits(logger, extraArgs[0])
case "list-bitmap-reachable":
if len(extraArgs) != 2 {
fatal(usage)
}
- listBitmapReachable(extraArgs[0], extraArgs[1])
+ listBitmapReachable(logger, extraArgs[0], extraArgs[1])
default:
fatal(usage)
}
diff --git a/cmd/gitaly-lfs-smudge/main_test.go b/cmd/gitaly-lfs-smudge/main_test.go
index e3e51b917..e251df335 100644
--- a/cmd/gitaly-lfs-smudge/main_test.go
+++ b/cmd/gitaly-lfs-smudge/main_test.go
@@ -183,7 +183,7 @@ func TestGitalyLFSSmudge(t *testing.T) {
env, logFile := tc.setup(t)
var stdout, stderr bytes.Buffer
- cmd, err := command.New(ctx, []string{binary},
+ cmd, err := command.New(ctx, testhelper.SharedLogger(t), []string{binary},
command.WithStdin(tc.stdin),
command.WithStdout(&stdout),
command.WithStderr(&stderr),