core: Remove Logger related methods from the Runtime and use the RuntimeX variants.
Also, changes to make it possible to port WSPR to the new model.
Change-Id: I47be6882f1e17fd2d4cab4f444b5b69a51d45056
MultiPart: 1/2
diff --git a/lib/modules/core/wspr.go b/lib/modules/core/wspr.go
index c93ae58..1298f5c 100644
--- a/lib/modules/core/wspr.go
+++ b/lib/modules/core/wspr.go
@@ -38,7 +38,7 @@
}
defer r.Cleanup()
l := initListenSpec(fl)
- proxy := wspr.NewWSPR(r, *port, nil, &l, *identd, nil)
+ proxy := wspr.NewWSPR(r.NewContext(), *port, nil, &l, *identd, nil)
defer proxy.Shutdown()
addr := proxy.Listen()
diff --git a/profiles/chrome/chrome.go b/profiles/chrome/chrome.go
index 413b386..322d022 100644
--- a/profiles/chrome/chrome.go
+++ b/profiles/chrome/chrome.go
@@ -42,7 +42,7 @@
}
func (c *chrome) Init(rt veyron2.Runtime, _ *config.Publisher) (veyron2.AppCycle, error) {
- rt.Logger().VI(1).Infof("%s", c)
+ veyron2.GetLogger(rt.NewContext()).VI(1).Infof("%s", c)
return nil, nil
}
diff --git a/profiles/generic.go b/profiles/generic.go
index 05ab50c..9b5ff05 100644
--- a/profiles/generic.go
+++ b/profiles/generic.go
@@ -49,7 +49,7 @@
}
func (g *generic) Init(rt veyron2.Runtime, _ *config.Publisher) (veyron2.AppCycle, error) {
- rt.Logger().VI(1).Infof("%s", g)
+ veyron2.GetLogger(rt.NewContext()).VI(1).Infof("%s", g)
g.ac = appcycle.New()
return g.ac, nil
}
diff --git a/profiles/roaming/roaming.go b/profiles/roaming/roaming.go
index c3352eb..a6661a9 100644
--- a/profiles/roaming/roaming.go
+++ b/profiles/roaming/roaming.go
@@ -78,7 +78,7 @@
}
func (p *profile) Init(rt veyron2.Runtime, publisher *config.Publisher) (veyron2.AppCycle, error) {
- log := rt.Logger()
+ log := veyron2.GetLogger(rt.NewContext())
rt.ConfigureReservedName(debug.NewDispatcher(log.LogDir(), sflag.NewAuthorizerOrDie()))
@@ -156,7 +156,7 @@
watcherLoop chan<- struct{}, ch chan<- config.Setting, listenSpec ipc.ListenSpec) {
defer close(ch)
- log := rt.Logger()
+ log := veyron2.GetLogger(rt.NewContext())
// TODO(cnicolaou): add support for listening on multiple network addresses.
diff --git a/profiles/static/static.go b/profiles/static/static.go
index 38dc172..683ebae 100644
--- a/profiles/static/static.go
+++ b/profiles/static/static.go
@@ -58,7 +58,7 @@
}
func (p *static) Init(rt veyron2.Runtime, _ *config.Publisher) (veyron2.AppCycle, error) {
- log := rt.Logger()
+ log := veyron2.GetLogger(rt.NewContext())
rt.ConfigureReservedName(debug.NewDispatcher(log.LogDir(), sflag.NewAuthorizerOrDie()))
diff --git a/runtimes/google/rt/rt_test.go b/runtimes/google/rt/rt_test.go
index 410364a..e238630 100644
--- a/runtimes/google/rt/rt_test.go
+++ b/runtimes/google/rt/rt_test.go
@@ -10,6 +10,7 @@
"testing"
"time"
+ "v.io/core/veyron2"
"v.io/core/veyron2/options"
"v.io/core/veyron2/rt"
"v.io/core/veyron2/security"
@@ -38,7 +39,7 @@
if err != nil {
t.Fatalf("error: %s", err)
}
- l := r.Logger()
+ l := veyron2.GetLogger(r.NewContext())
args := fmt.Sprintf("%s", l)
expected := regexp.MustCompile("name=veyron logdirs=\\[/tmp\\] logtostderr=true|false alsologtostderr=false|true max_stack_buf_size=4292608 v=[0-9] stderrthreshold=2 vmodule= log_backtrace_at=:0")
if !expected.MatchString(args) {
@@ -66,8 +67,9 @@
}
defer r.Cleanup()
- vlog.Infof("%s\n", r.Logger())
- fmt.Fprintf(stdout, "%s\n", r.Logger())
+ logger := veyron2.GetLogger(r.NewContext())
+ vlog.Infof("%s\n", logger)
+ fmt.Fprintf(stdout, "%s\n", logger)
modules.WaitForEOF(stdin)
fmt.Fprintf(stdout, "done\n")
return nil
diff --git a/security/agent/agentd/main.go b/security/agent/agentd/main.go
index 69ea3d9..7f4d824 100644
--- a/security/agent/agentd/main.go
+++ b/security/agent/agentd/main.go
@@ -19,6 +19,7 @@
"v.io/core/veyron/security/agent"
"v.io/core/veyron/security/agent/server"
+ "v.io/core/veyron2"
"v.io/core/veyron2/options"
"v.io/core/veyron2/rt"
"v.io/core/veyron2/security"
@@ -83,7 +84,7 @@
ctx := runtime.NewContext()
- log := runtime.Logger()
+ log := veyron2.GetLogger(ctx)
if err = os.Setenv(agent.FdVarName, "3"); err != nil {
log.Fatalf("setenv: %v", err)