Update logging
Change-Id: I13279582aa717edad5d56323866b941db1919404
diff --git a/server/git/git.go b/server/git/git.go
index dc3885f..9aa1ae2 100644
--- a/server/git/git.go
+++ b/server/git/git.go
@@ -3,6 +3,7 @@
import (
"context"
"fmt"
+ "log/slog"
"os"
"os/exec"
"path/filepath"
@@ -189,6 +190,7 @@
repoPath string
config GitConfig
prProvider PullRequestProvider
+ logger *slog.Logger
}
// GitConfig holds configuration for Git operations
@@ -199,7 +201,7 @@
}
// NewGit creates a new Git instance
-func NewGit(repoPath string, config GitConfig) GitInterface {
+func NewGit(repoPath string, config GitConfig, logger *slog.Logger) GitInterface {
if config.Timeout == 0 {
config.Timeout = 30 * time.Second
}
@@ -208,6 +210,7 @@
repoPath: repoPath,
config: config,
prProvider: config.PullRequestProvider,
+ logger: logger,
}
}
@@ -215,14 +218,13 @@
func DefaultGit(repoPath string) GitInterface {
return NewGit(repoPath, GitConfig{
Timeout: 30 * time.Second,
- Env: make(map[string]string),
- })
+ }, slog.Default())
}
// NewGitWithPullRequests creates a Git instance with pull request capabilities
-func NewGitWithPullRequests(repoPath string, config GitConfig, prProvider PullRequestProvider) GitInterface {
+func NewGitWithPullRequests(repoPath string, config GitConfig, prProvider PullRequestProvider, logger *slog.Logger) GitInterface {
config.PullRequestProvider = prProvider
- return NewGit(repoPath, config)
+ return NewGit(repoPath, config, logger)
}
// Ensure Git implements GitInterface