Exemple #1
0
func NewTestServer() *TestServer {
	ctx, _ := aetest.NewContext(nil)
	// reset sinks
	level, err := wcg.ParseLogLevel(os.Getenv("LOGGING_LEVEL"))
	if err == nil {
		wcg.LogConfig.Level = level
	}
	wcg.LogConfig.ConfigureSinks()
	wcg.LogConfig.AddSink(
		gae.NewGAELogSinkWithContext(gae.LogSinkConfig.Format, ctx),
		level,
	)
	ts := &TestServer{
		Context: ctx,
	}
	return ts
}
Exemple #2
0
func RunTestServer(f func(*TestServer)) {
	ctx, _ := aetest.NewContext(nil)
	defer func() {
		ctx.Close()
	}()
	// reset sinks
	level, err := wcg.ParseLogLevel(os.Getenv("LOGGING_LEVEL"))
	if err == nil {
		wcg.LogConfig.Level = level
	}
	wcg.LogConfig.ConfigureSinks()
	wcg.LogConfig.AddSink(
		gae.NewGAELogSinkWithContext(gae.LogSinkConfig.Format, ctx),
		level,
	)
	ts := &TestServer{
		Context: ctx,
	}
	f(ts)
}