core: replace zap with logtree
Test Plan: Effective refactor. Only tests that could be affected are e2e tests that should continue to run, because we still are logging into the qemu console, even if differently.
X-Origin-Diff: phab/D642
GitOrigin-RevId: 0f12b1bc985af08a3cc269569273184321763e4b
diff --git a/core/cmd/init/switchroot.go b/core/cmd/init/switchroot.go
index d51b1fa..8308a25 100644
--- a/core/cmd/init/switchroot.go
+++ b/core/cmd/init/switchroot.go
@@ -25,14 +25,15 @@
"strings"
"syscall"
- "go.uber.org/zap"
+ "git.monogon.dev/source/nexantic.git/core/pkg/logtree"
+
"golang.org/x/sys/unix"
)
// switchRoot moves the root from initramfs into a tmpfs
// This is necessary because you cannot pivot_root from a initramfs (and runsc wants to do that).
// In the future, we should instead use something like squashfs instead of an initramfs and just nuke this.
-func switchRoot(log *zap.Logger) error {
+func switchRoot(log logtree.LeveledLogger) error {
// We detect the need to remount to tmpfs over env vars.
// The first run of /init (from initramfs) will not have this var, and will be re-exec'd from a new tmpfs root with
// that variable set.
@@ -78,7 +79,10 @@
return fmt.Errorf("could not list root files: %w", err)
}
- log.Info("Copying to tmpfs", zap.Strings("paths", paths), zap.Strings("dirs", dirs))
+ log.Info("Copying paths to tmpfs:")
+ for _, p := range paths {
+ log.Infof(" - %s", p)
+ }
// Make new root at /mnt
if err := os.Mkdir("/mnt", 0755); err != nil {