1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00

client/oci: Set the umoci logger on init

Closes #2481

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber
2025-09-25 14:33:53 -04:00
parent c48c3be846
commit 43b02c81f1

View File

@@ -14,6 +14,14 @@ import (
"github.com/lxc/incus/v6/shared/logger"
)
func init() {
// apex/log is only used by umoci within Incus.
// So configure its logger to forward to our logger with the relevant prefix.
// Set the custom handler.
log.SetHandler(&umociLogHandler{Message: "Unpacking OCI image"})
}
// Custom handler to intercept logs.
type umociLogHandler struct {
Message string
@@ -40,10 +48,6 @@ func (h *umociLogHandler) HandleLog(e *log.Entry) error {
}
func unpackOCIImage(imagePath string, imageTag string, bundlePath string) error {
// Set the custom handler
log.SetHandler(&umociLogHandler{Message: "Unpacking OCI image"})
defer log.SetHandler(nil)
var unpackOptions layer.UnpackOptions
unpackOptions.KeepDirlinks = true