osbase/logtree.LeveledLogger -> go/logging.Leveled

This factors out the common leveled logger interface out of the logtree.
We want to use the same interface outside of logtree/supervisor usage
within the resolver code, which will be exposed to clients.

Change-Id: I299e76d91e8cefddf8f36f1e58432418c4694df2
Reviewed-on: https://review.monogon.dev/c/monogon/+/3411
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/rpc/BUILD.bazel b/metropolis/node/core/rpc/BUILD.bazel
index e80ded4..fcc68fa 100644
--- a/metropolis/node/core/rpc/BUILD.bazel
+++ b/metropolis/node/core/rpc/BUILD.bazel
@@ -13,10 +13,10 @@
     importpath = "source.monogon.dev/metropolis/node/core/rpc",
     visibility = ["//visibility:public"],
     deps = [
+        "//go/logging",
         "//metropolis/node/core/identity",
         "//metropolis/proto/api",
         "//metropolis/proto/ext",
-        "//osbase/logtree",
         "@org_golang_google_grpc//:grpc",
         "@org_golang_google_grpc//codes",
         "@org_golang_google_grpc//credentials",
diff --git a/metropolis/node/core/rpc/server_authentication.go b/metropolis/node/core/rpc/server_authentication.go
index c7d6e91..eed7dba 100644
--- a/metropolis/node/core/rpc/server_authentication.go
+++ b/metropolis/node/core/rpc/server_authentication.go
@@ -12,8 +12,8 @@
 	"google.golang.org/grpc/peer"
 	"google.golang.org/grpc/status"
 
+	"source.monogon.dev/go/logging"
 	"source.monogon.dev/metropolis/node/core/identity"
-	"source.monogon.dev/osbase/logtree"
 )
 
 // ServerSecurity are the security options of a RPC server that will run
@@ -37,7 +37,7 @@
 // metropolis.proto.ext.authorization options and authenticate/authorize
 // incoming connections. It also runs the gRPC server with the correct TLS
 // settings for authenticating itself to callers.
-func (s *ServerSecurity) GRPCOptions(logger logtree.LeveledLogger) []grpc.ServerOption {
+func (s *ServerSecurity) GRPCOptions(logger logging.Leveled) []grpc.ServerOption {
 	externalCreds := credentials.NewTLS(&tls.Config{
 		Certificates: []tls.Certificate{s.NodeCredentials.TLSCredentials()},
 		ClientAuth:   tls.RequestClientCert,
@@ -53,7 +53,7 @@
 // streamInterceptor returns a gRPC StreamInterceptor interface for use with
 // grpc.NewServer. It's applied to gRPC servers started within Metropolis,
 // notably to the Curator.
-func (s *ServerSecurity) streamInterceptor(logger logtree.LeveledLogger) grpc.StreamServerInterceptor {
+func (s *ServerSecurity) streamInterceptor(logger logging.Leveled) grpc.StreamServerInterceptor {
 	return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
 		var span *logtreeSpan
 		// HACK: Do not log any log retrieval methods into the log, otherwise logs blow up
@@ -87,7 +87,7 @@
 // unaryInterceptor returns a gRPC UnaryInterceptor interface for use with
 // grpc.NewServer. It's applied to gRPC servers started within Metropolis,
 // notably to the Curator.
-func (s *ServerSecurity) unaryInterceptor(logger logtree.LeveledLogger) grpc.UnaryServerInterceptor {
+func (s *ServerSecurity) unaryInterceptor(logger logging.Leveled) grpc.UnaryServerInterceptor {
 	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
 		// Inject span if we have a logger.
 		if logger != nil {
diff --git a/metropolis/node/core/rpc/trace.go b/metropolis/node/core/rpc/trace.go
index a686c06..f27a311 100644
--- a/metropolis/node/core/rpc/trace.go
+++ b/metropolis/node/core/rpc/trace.go
@@ -10,7 +10,7 @@
 	"google.golang.org/protobuf/encoding/prototext"
 	"google.golang.org/protobuf/proto"
 
-	"source.monogon.dev/osbase/logtree"
+	"source.monogon.dev/go/logging"
 )
 
 // Span implements a compatible subset of
@@ -64,14 +64,14 @@
 	// logger is the logtree LeveledLogger backing this span. All Events added into
 	// the Span will go straight into that logger. If the logger is nil, all events
 	// will be dropped instead.
-	logger logtree.LeveledLogger
+	logger logging.Leveled
 	// uid is the span ID of this logtreeSpan. Currently this is a monotonic counter
 	// based on the current nanosecond epoch, but this might change in the future.
 	// This field is ignored if logger is nil.
 	uid uint64
 }
 
-func newLogtreeSpan(l logtree.LeveledLogger) *logtreeSpan {
+func newLogtreeSpan(l logging.Leveled) *logtreeSpan {
 	uid := uint64(time.Now().UnixNano())
 	return &logtreeSpan{
 		logger: l,