Skip to content

Commit

Permalink
fixed issues detected by bazel check
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf committed Jan 24, 2024
1 parent e75bb42 commit cde9f9d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion debugd/internal/debugd/logcollector/logcollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ type cmdLogger struct {
}

func (c *cmdLogger) Write(p []byte) (n int, err error) {
c.logger.Info(fmt.Sprintf("%s", p))
c.logger.Info(string(p))
return len(p), nil
}

Expand Down
2 changes: 1 addition & 1 deletion hack/bazel-deps-mirror/internal/mirror/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (m *Maintainer) put(ctx context.Context, hash string, data io.Reader) error
m.log.Debug(fmt.Sprintf("DryRun: s3 put object {Bucket: %v, Key: %v}", m.bucket, key))
return nil
}
m.log.Debug(fmt.Sprintf(fmt.Sprintf("Uploading object with hash %v to s3://%v/%v", hash, m.bucket, key)))
m.log.Debug(fmt.Sprintf("Uploading object with hash %v to s3://%v/%v", hash, m.bucket, key))
_, err := m.uploadClient.Upload(ctx, &s3.PutObjectInput{
Bucket: &m.bucket,
Key: &key,
Expand Down
4 changes: 2 additions & 2 deletions internal/attestation/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ type Logger interface {
// NOPLogger is a no-op implementation of [Logger].
type NOPLogger struct{}

// Infof is a no-op.
// Info is a no-op.
func (NOPLogger) Info(string, ...interface{}) {}

// Warnf is a no-op.
// Warn is a no-op.
func (NOPLogger) Warn(string, ...interface{}) {}

// DeriveClusterID derives the cluster ID from a salt and secret value.
Expand Down
2 changes: 1 addition & 1 deletion internal/grpc/grpclog/grpclog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type spyLog struct {
msgs []string
}

func (f *spyLog) Debug(msg string, args ...any) {
func (f *spyLog) Debug(msg string, _ ...any) {
f.msgs = append(f.msgs, msg)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/logger/grpclogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func replaceGRPCLogger(log *slog.Logger) {
func (l *grpcLogger) log(level slog.Level, args ...interface{}) {
var pcs [1]uintptr
runtime.Callers(3, pcs[:])
r := slog.NewRecord(time.Now(), slog.LevelInfo, fmt.Sprint(args...), pcs[0])
r := slog.NewRecord(time.Now(), level, fmt.Sprint(args...), pcs[0])
_ = l.logger.Handler().Handle(context.Background(), r)
}

func (l *grpcLogger) logf(level slog.Level, format string, args ...interface{}) {
var pcs [1]uintptr
runtime.Callers(3, pcs[:])
r := slog.NewRecord(time.Now(), slog.LevelInfo, fmt.Sprintf(format, args...), pcs[0])
r := slog.NewRecord(time.Now(), level, fmt.Sprintf(format, args...), pcs[0])
_ = l.logger.Handler().Handle(context.Background(), r)
}

Expand Down
3 changes: 2 additions & 1 deletion internal/logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ func middlewareLogger(l *slog.Logger) logging.Logger {
panic(fmt.Sprintf("unknown level %v", lvl))
}

r := slog.NewRecord(time.Now(), level, fmt.Sprintf(msg, fields...), pcs[0])
r := slog.NewRecord(time.Now(), level, fmt.Sprintf(msg, f), pcs[0])
_ = l.Handler().Handle(context.Background(), r)
})
}

// NewTest creates a new slog.Logger that writes to a testing.T.
func NewTest(t *testing.T) *slog.Logger {
return slog.New(slog.NewTextHandler(testWriter{t: t}, nil))
}
Expand Down

0 comments on commit cde9f9d

Please sign in to comment.