Skip to content

Commit

Permalink
Replace log.Print calls with slog.InfoContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ellismg committed Dec 17, 2024
1 parent d61ad30 commit 5fd6028
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cli/azd/internal/vsrpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"log/slog"
"net"
"net/http"
Expand Down Expand Up @@ -96,7 +95,7 @@ func (s *Server) Serve(l net.Listener) error {
func serveRpc(w http.ResponseWriter, r *http.Request, handlers map[string]Handler) {
c, err := upgrader.Upgrade(w, r, nil)
if err != nil {
log.Print("upgrade:", err)
slog.InfoContext(r.Context(), "error upgrading connect", "err", err)
return
}
defer c.Close()
Expand Down
2 changes: 1 addition & 1 deletion cli/azd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func fetchLatestVersion(version chan<- semver.Version) {

// If we don't have a cached version we can use, fetch one (and cache it)
if cachedLatestVersion == nil {
log.Print("fetching latest version information for update check")
slog.InfoContext(context.TODO(), "fetching latest version information for update check")
req, err := http.NewRequest(http.MethodGet, "https://aka.ms/azure-dev/versions/cli/latest", nil)
if err != nil {
slog.InfoContext(context.TODO(), "failed to create request object, skipping update check", "err", err)
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/pkg/exec/command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"io"
"log"
"log/slog"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -304,7 +304,7 @@ func (l *logBuilder) Write(debug bool, sensitiveArgsData []string) {
}
}

log.Print(msg.String())
slog.InfoContext(context.TODO(), msg.String())
}

// newCmdTree creates a `CmdTree`, optionally using a shell appropriate for windows
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/pkg/oneauth/oneauth_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"context"
_ "embed"
"fmt"
"log"
"log/slog"
"os"
"path/filepath"
"strings"
Expand All @@ -54,7 +54,7 @@ import (

//export goLog
func goLog(s *C.char) {
log.Print(C.GoString(s))
slog.InfoContext(context.TODO(), C.GoString(s))
}

// Supported indicates whether this build includes OneAuth integration.
Expand Down

0 comments on commit 5fd6028

Please sign in to comment.