Skip to content

External-ccm: Use appropriate method for printf-style log calls#524

Open
HadrienPatte wants to merge 1 commit intooracle:masterfrom
DataDog:pr/HadrienPatte/log-format
Open

External-ccm: Use appropriate method for printf-style log calls#524
HadrienPatte wants to merge 1 commit intooracle:masterfrom
DataDog:pr/HadrienPatte/log-format

Conversation

@HadrienPatte
Copy link

zap's sugared logger Fatal/Error/Info/Debug methods treat their first argument as a plain string, not a format string. Passing format verbs like %s/%v without the 'f' suffix causes them to appear literally in log output instead of being interpolated.

Example of a log with no printf formatting we can see today:

2026-03-06T21:08:01.983Z        FATAL   FSS     csi-controller-driver/oci-csi-controller-driver.go:56 Failed to run the CSI driver for %s.FSS {"component": "csi-controller", "error": "failed to remove unix domain socket file /var/run/shared-tmpfs/csi-fss.sock"}

Also removed a duplicated error from a log in node_info_controller.go where err was attached to the log both with zap.Error(err) and through a (broken) printf-style %v.

zap's sugared logger `Fatal`/`Error`/`Info`/`Debug` methods treat their
first argument as a plain string, not a format string. Passing format
verbs like `%s`/`%v` without the 'f' suffix causes them to appear
literally in log output instead of being interpolated.

Example of a log with no printf formatting we can see today:
```
2026-03-06T21:08:01.983Z        FATAL   FSS     csi-controller-driver/oci-csi-controller-driver.go:56 Failed to run the CSI driver for %s.FSS {"component": "csi-controller", "error": "failed to remove unix domain socket file /var/run/shared-tmpfs/csi-fss.sock"}
```

Also removed a duplicated error from a log in `node_info_controller.go`
where `err` was attached to the log both with `zap.Error(err)` and
through a (broken) printf-style `%v`.

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 6, 2026
Copy link
Contributor

@AkarshES AkarshES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants