Ejemplo n.º 1
0
// DefaultConfig provides a default configuration to create a new server object
// by best effort.
func DefaultConfig() Config {
	newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
	if err != nil {
		panic(err)
	}

	newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
	if err != nil {
		panic(err)
	}

	newTextInterface, err := text.NewServer(text.DefaultServerConfig())
	if err != nil {
		panic(err)
	}

	newConfig := Config{
		// Dependencies.

		Instrumentation: newInstrumentation,
		Log:             log.New(log.DefaultConfig()),
		LogControl:      newLogControl,
		TextInterface:   newTextInterface,

		// Settings.

		GRPCAddr: "127.0.0.1:9119",
		HTTPAddr: "127.0.0.1:9120",
	}

	return newConfig
}
Ejemplo n.º 2
0
func newLogControl(newLog spec.Log) (spec.LogControl, error) {
	newLogControlConfig := log.DefaultControlConfig()
	newLogControlConfig.Log = newLog
	newLogControl, err := log.NewControl(newLogControlConfig)
	if err != nil {
		return nil, maskAny(err)
	}

	return newLogControl, nil
}