chore(general): use non-formatting log variants when there is no formatting (#3931)

Use non-formatting logging functions for message without formatting.
For example, `log.Info("message")` instead of `log.Infof("message")`

Configure linter for printf-like functions
This commit is contained in:
Julio López authored and GitHub committed 2024-06-18 23:13:17 -07:00
1 parent 7514a3563f
commit 1f9f9a1846
65 files changed
+188 -176

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ func logBucketSamples(ctx context.Context, buckets snapshotfs.SampleBuckets, pre
hasAny = true
if showExamples && len(bucket.Examples) > 0 {
log(ctx).Infof("Examples:")
log(ctx).Info("Examples:")
for _, sample := range bucket.Examples {
log(ctx).Infof(" - %v\n", sample)
+4 -4
View File
@@ -474,7 +474,7 @@ func handleFlush(ctx context.Context, rc requestContext) (interface{}, *apiError
}
func handleShutdown(ctx context.Context, rc requestContext) (interface{}, *apiError) {
log(ctx).Infof("shutting down due to API request")
log(ctx).Info("shutting down due to API request")
rc.srv.requestShutdown(ctx)
@@ -552,9 +552,9 @@ func (s *Server) SetRepository(ctx context.Context, rep repo.Repository) error {
s.unmountAllLocked(ctx)
// close previous source managers
log(ctx).Debugf("stopping all source managers")
log(ctx).Debug("stopping all source managers")
s.stopAllSourceManagersLocked(ctx)
log(ctx).Debugf("stopped all source managers")
log(ctx).Debug("stopped all source managers")
if err := s.rep.Close(ctx); err != nil {
return errors.Wrap(err, "unable to close previous repository")
@@ -856,7 +856,7 @@ func (s *Server) InitRepositoryAsync(ctx context.Context, mode string, initializ
}
if rep == nil {
log(ctx).Infof("Repository not configured.")
log(ctx).Info("Repository not configured.")
}
if err = s.SetRepository(ctx, rep); err != nil {
+3 -3
View File
@@ -250,7 +250,7 @@ func (s *sourceManager) cancel(ctx context.Context) serverapi.SourceActionRespon
log(ctx).Debugw("cancel triggered via API", "source", s.src)
if u := s.currentUploader(); u != nil {
log(ctx).Infof("canceling current upload")
log(ctx).Info("canceling current upload")
u.Cancel()
}
@@ -265,7 +265,7 @@ func (s *sourceManager) pause(ctx context.Context) serverapi.SourceActionRespons
s.sourceMutex.Unlock()
if u := s.currentUploader(); u != nil {
log(ctx).Infof("canceling current upload")
log(ctx).Info("canceling current upload")
u.Cancel()
}
@@ -371,7 +371,7 @@ func (s *sourceManager) snapshotInternal(ctx context.Context, ctrl uitask.Contro
ignoreIdenticalSnapshot := policyTree.EffectivePolicy().RetentionPolicy.IgnoreIdenticalSnapshots.OrDefault(false)
if ignoreIdenticalSnapshot && len(manifestsSinceLastCompleteSnapshot) > 0 {
if manifestsSinceLastCompleteSnapshot[0].RootObjectID() == manifest.RootObjectID() {
log(ctx).Debugf("Not saving snapshot because no files have been changed since previous snapshot")
log(ctx).Debug("Not saving snapshot because no files have been changed since previous snapshot")
return nil
}
}