Skip to content

Commit e66dd60

Browse files
mauri870Rohit-code14
authored andcommitted
chore: fix formatting issues in logp printf-style calls (elastic#9732)
1 parent 9dfd0d1 commit e66dd60

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

internal/pkg/agent/application/actions/handlers/handler_action_policy_reassign.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ func (h *PolicyReassign) Handle(ctx context.Context, a fleetapi.Action, acker ac
2929
h.log.Debugf("handlerPolicyReassign: action '%+v' received", a)
3030

3131
if err := acker.Ack(ctx, a); err != nil {
32-
h.log.Errorf("failed to acknowledge POLICY_REASSIGN action with id '%s'", a.ID)
32+
h.log.Errorf("failed to acknowledge POLICY_REASSIGN action with id '%s'", a.ID())
3333
} else if err := acker.Commit(ctx); err != nil {
34-
h.log.Errorf("failed to commit acker after acknowledging action with id '%s'", a.ID)
34+
h.log.Errorf("failed to commit acker after acknowledging action with id '%s'", a.ID())
3535
}
3636

3737
return nil

internal/pkg/agent/application/upgrade/artifact/download/http/verify_backoff_rtt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ func (btr *BackoffRoundTripper) RoundTrip(req *http.Request) (*http.Response, er
6363
if resettableBody != nil {
6464
_, err = resettableBody.Seek(0, io.SeekStart)
6565
if err != nil {
66-
btr.logger.Errorf("error while resetting request body: %w", err)
66+
btr.logger.Errorf("error while resetting request body: %v", err)
6767
}
6868
}
6969

7070
attempt++
7171
resp, err = btr.next.RoundTrip(req) //nolint:bodyclose // the response body is closed when status code >= 400 or it is closed by the caller
7272
if err != nil {
73-
btr.logger.Errorf("attempt %d: error round-trip: %w", err)
73+
btr.logger.Errorf("attempt %d: error round-trip: %v", attempt, err)
7474
return err
7575
}
7676

7777
if resp.StatusCode >= 400 {
7878
if err := resp.Body.Close(); err != nil {
79-
btr.logger.Errorf("attempt %d: error closing the response body: %w", attempt, err)
79+
btr.logger.Errorf("attempt %d: error closing the response body: %v", attempt, err)
8080
}
8181
btr.logger.Errorf("attempt %d: received response status: %d", attempt, resp.StatusCode)
8282
return errors.New(fmt.Sprintf("received response status: %d", resp.StatusCode))

internal/pkg/agent/application/upgrade/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (u *Upgrader) Upgrade(ctx context.Context, version string, sourceURI string
269269
// in case of error fallback to keep-all
270270
detectedFlavor, err := install.UsedFlavor(paths.Top(), "")
271271
if err != nil {
272-
u.log.Warnf("error encountered when detecting used flavor with top path %q: %w", paths.Top(), err)
272+
u.log.Warnf("error encountered when detecting used flavor with top path %q: %v", paths.Top(), err)
273273
}
274274
u.log.Debugf("detected used flavor: %q", detectedFlavor)
275275
unpackRes, err := u.unpack(version, archivePath, paths.Data(), detectedFlavor)

internal/pkg/agent/migration/migrate_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func MigrateToEncryptedConfig(ctx context.Context, l *logp.Logger, unencryptedCo
3232

3333
unencStat, unencFileErr := os.Stat(unencryptedConfigPath)
3434

35-
l.Debugf(fmt.Sprintf("checking stat of enc config %q: %+v, err: %v", encryptedConfigPath, encStat, encFileErr))
36-
l.Debugf(fmt.Sprintf("checking stat of unenc config %q: %+v, err: %v", unencryptedConfigPath, unencStat, unencFileErr))
35+
l.Debugf("checking stat of enc config %q: %+v, err: %v", encryptedConfigPath, encStat, encFileErr)
36+
l.Debugf("checking stat of unenc config %q: %+v, err: %v", unencryptedConfigPath, unencStat, unencFileErr)
3737

3838
isEncryptedConfigEmpty := errors.Is(encFileErr, fs.ErrNotExist) || encStat.Size() == 0
3939
isUnencryptedConfigPresent := unencFileErr == nil && unencStat.Size() > 0
@@ -54,7 +54,7 @@ func MigrateToEncryptedConfig(ctx context.Context, l *logp.Logger, unencryptedCo
5454
defer func() {
5555
err = reader.Close()
5656
if err != nil {
57-
l.Errorf(fmt.Sprintf("Error closing unencrypted store reader for %q: %v", unencryptedConfigPath, err))
57+
l.Errorf("Error closing unencrypted store reader for %q: %v", unencryptedConfigPath, err)
5858
}
5959
}()
6060
store, err := storage.NewEncryptedDiskStore(ctx, encryptedConfigPath, storageOpts...)

internal/pkg/composable/providers/kubernetes/kubernetes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (p *dynamicProvider) watchResource(
124124
}
125125
p.config.Node, err = kubernetes.DiscoverKubernetesNode(p.logger, nd)
126126
if err != nil {
127-
p.logger.Debugf("Kubernetes provider skipped, unable to discover node: %w", err)
127+
p.logger.Debugf("Kubernetes provider skipped, unable to discover node: %v", err)
128128
return nil, nil
129129
}
130130

internal/pkg/config/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (l *Loader) Load(files []string) (*Config, error) {
5353
return nil, fmt.Errorf("cannot get configuration from '%s': %w", f, err)
5454
}
5555
inputsList = append(inputsList, inp...)
56-
l.logger.Debugf("Loaded %s input(s) from configuration from %s", len(inp), f)
56+
l.logger.Debugf("Loaded %d input(s) from configuration from %s", len(inp), f)
5757
} else {
5858
if err := merger.Add(cfg.access(), err); err != nil {
5959
return nil, fmt.Errorf("failed to merge configuration file '%s' to existing one: %w", f, err)

internal/pkg/remote/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func (c *Client) Send(
221221
errs = append(errs, fmt.Errorf("%s: %w", msg, err))
222222

223223
// Using debug level as the error is only relevant if all clients fail.
224-
c.log.With("error", err).Debugf(msg)
224+
c.log.With("error", err).Debug(msg)
225225
continue
226226
}
227227
c.checkApiVersionHeaders(req, resp)

pkg/testing/ess/serverless_provisioner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (log *defaultLogger) Logf(format string, args ...any) {
3434
if len(args) == 0 {
3535

3636
} else {
37-
log.wrapped.Infof(format, args)
37+
log.wrapped.Infof(format, args...)
3838
}
3939

4040
}

0 commit comments

Comments
 (0)