osbase/supervisor: allow access to LogTree from Runnable

This adds a way to access the underlying LogTree instance from
a runnable with the same API as normal logger access. This is required
for migrating metropolis/node/core to use bringup.

Change-Id: I867ff0ff104bd7f524667a66aaaf13fc29c8f25c
Reviewed-on: https://review.monogon.dev/c/monogon/+/3704
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/supervisor/supervisor.go b/osbase/supervisor/supervisor.go
index 5570945..b11c1a9 100644
--- a/osbase/supervisor/supervisor.go
+++ b/osbase/supervisor/supervisor.go
@@ -209,3 +209,11 @@
 	}
 	return l
 }
+
+// LogTree returns the LogTree used by this supervisor instance. This should
+// only be used for reading logs. For writing logs use SubLogger instead.
+func LogTree(ctx context.Context) *logtree.LogTree {
+	node, unlock := fromContext(ctx)
+	defer unlock()
+	return node.sup.logtree
+}