ref/lib/logger: provide an implementation of v23/logger.
MultiPart: 2/3
Change-Id: Idc9f5e90863ee40f336be058d9384b8a44a5f2d3
diff --git a/runtime/factories/fake/runtime.go b/runtime/factories/fake/runtime.go
index 2812aaf..16ee8a4 100644
--- a/runtime/factories/fake/runtime.go
+++ b/runtime/factories/fake/runtime.go
@@ -9,7 +9,7 @@
"v.io/v23/context"
"v.io/v23/rpc"
"v.io/v23/security"
- "v.io/x/ref/lib/apilog"
+
vsecurity "v.io/x/ref/lib/security"
)
@@ -34,28 +34,28 @@
}
func (r *Runtime) Init(ctx *context.T) error {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
return nil
}
func (r *Runtime) WithPrincipal(ctx *context.T, principal security.Principal) (*context.T, error) {
- defer apilog.LogCallf(ctx, "principal=")(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
return context.WithValue(ctx, principalKey, principal), nil
}
func (r *Runtime) GetPrincipal(ctx *context.T) security.Principal {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
p, _ := ctx.Value(principalKey).(security.Principal)
return p
}
func (r *Runtime) GetAppCycle(ctx *context.T) v23.AppCycle {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
panic("unimplemented")
}
func (r *Runtime) WithBackgroundContext(ctx *context.T) *context.T {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
// Note we add an extra context with a nil value here.
// This prevents users from travelling back through the
// chain of background contexts.
@@ -64,7 +64,7 @@
}
func (r *Runtime) GetBackgroundContext(ctx *context.T) *context.T {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
bctx, _ := ctx.Value(backgroundKey).(*context.T)
if bctx == nil {
// There should always be a background context. If we don't find
@@ -77,11 +77,11 @@
}
func (*Runtime) WithReservedNameDispatcher(ctx *context.T, d rpc.Dispatcher) *context.T {
- defer apilog.LogCallf(ctx, "d=")(ctx, "") // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
panic("unimplemented")
}
func (*Runtime) GetReservedNameDispatcher(ctx *context.T) rpc.Dispatcher {
- defer apilog.LogCall(ctx)(ctx) // gologcop: DO NOT EDIT, MUST BE FIRST STATEMENT
+ // nologcall
panic("unimplmeneted")
}
diff --git a/runtime/factories/roaming/roaming.go b/runtime/factories/roaming/roaming.go
index 9f6c8ef..40d82e0 100644
--- a/runtime/factories/roaming/roaming.go
+++ b/runtime/factories/roaming/roaming.go
@@ -26,6 +26,7 @@
"v.io/v23/context"
"v.io/v23/rpc"
+ "v.io/x/ref/internal/logger"
"v.io/x/ref/lib/flags"
"v.io/x/ref/lib/security/securityflag"
"v.io/x/ref/runtime/internal"
@@ -62,14 +63,14 @@
Addrs: rpc.ListenAddrs(lf.Addrs),
Proxy: lf.ListenProxy,
}
- reservedDispatcher := debuglib.NewDispatcher(vlog.Log.LogDir, securityflag.NewAuthorizerOrDie())
+ reservedDispatcher := debuglib.NewDispatcher(logger.Manager(logger.Global()).LogDir, securityflag.NewAuthorizerOrDie())
ac := appcycle.New()
// Our address is private, so we test for running on GCE and for its
// 1:1 NAT configuration.
- if !internal.HasPublicIP(vlog.Log) {
- if addr := internal.GCEPublicAddress(vlog.Log); addr != nil {
+ if !internal.HasPublicIP(logger.Global()) {
+ if addr := internal.GCEPublicAddress(logger.Global()); addr != nil {
listenSpec.AddressChooser = func(string, []net.Addr) ([]net.Addr, error) {
// TODO(cnicolaou): the protocol at least should
// be configurable, or maybe there's a RuntimeFactory specific
diff --git a/runtime/factories/static/static.go b/runtime/factories/static/static.go
index c49bd32..c0873bb 100644
--- a/runtime/factories/static/static.go
+++ b/runtime/factories/static/static.go
@@ -9,12 +9,11 @@
"flag"
"net"
- "v.io/x/lib/vlog"
-
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
+ "v.io/x/ref/internal/logger"
"v.io/x/ref/lib/flags"
"v.io/x/ref/lib/security/securityflag"
"v.io/x/ref/runtime/internal"
@@ -45,15 +44,15 @@
Addrs: rpc.ListenAddrs(lf.Addrs),
Proxy: lf.ListenProxy,
}
- reservedDispatcher := debuglib.NewDispatcher(vlog.Log.LogDir, securityflag.NewAuthorizerOrDie())
+ reservedDispatcher := debuglib.NewDispatcher(logger.Manager(logger.Global()).LogDir, securityflag.NewAuthorizerOrDie())
ac := appcycle.New()
// Our address is private, so we test for running on GCE and for its 1:1 NAT
// configuration. GCEPublicAddress returns a non-nil addr if we are
// running on GCE.
- if !internal.HasPublicIP(vlog.Log) {
- if addr := internal.GCEPublicAddress(vlog.Log); addr != nil {
+ if !internal.HasPublicIP(logger.Global()) {
+ if addr := internal.GCEPublicAddress(logger.Global()); addr != nil {
listenSpec.AddressChooser = func(string, []net.Addr) ([]net.Addr, error) {
return []net.Addr{addr}, nil
}