-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for structured logging (using log/slog
)
#2217
Comments
Thanks for reaching out. At this point, c/image only requires Go 1.19, so this is not yet possible (a migration to Go 1.20 could happen pretty soon, but we are probably going to be stuck on 1.20 support for the supported lifetime of Fedora 38). Longer-term, yes,
|
About the support for older Go versions: the |
Looks as if you are at Go 1.21 now... with #2377 |
First the callers need to be able to handle a library that uses both logging frameworks, something vaguely like https://github.com/mtrmac/skopeo/tree/logrus-deprecate . It’s… tedious work and for interactive use, the output is not particularly pleasant. For non-debug output progress output, manually using |
For Skopeo (and other interactive programs), using We use Logrus hooks to transport logging messages into the But we use the c/image library in a Kubernetes operator, and we perform several (up to eight) image operations im parallel. In that environment, it is highly desirable to use context-aware logging to separate the sequential activities for each image operation. Furthermore, logging frameworks (like Fluentd) are already collecting structured logs and make them available for queries. |
As of now, the containers/image library uses the
sirupsen/logrus
package for logging. This has a major drawback: when performing image activities for several images in different goroutines in parallel, it is not possible to mark or tag the log messages such that they an be attributed to the right activity.Go 1.21 introduced structured logging (see Structured Logging with slog), allowing logger instances to be used as arguments and attributed to specific activities.
Please consider adding structured loggers to the API calls in the
containers/image
library.The text was updated successfully, but these errors were encountered: