Example #1
0
func loggingOpts(env jutil.Env, jOpts jutil.Object) (dir vlog.LogDir, toStderr vlog.LogToStderr, level vlog.Level, vmodule vlog.ModuleSpec, err error) {
	var d string
	d, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_DIR")
	if err != nil {
		return
	}
	dir = vlog.LogDir(d)
	var s bool
	s, err = jutil.GetBooleanOption(env, jOpts, "io.v.v23.LOG_TO_STDERR")
	if err != nil {
		return
	}
	toStderr = vlog.LogToStderr(s)
	var l int
	l, err = jutil.GetIntOption(env, jOpts, "io.v.v23.LOG_VLEVEL")
	if err != nil {
		return
	}
	level = vlog.Level(l)
	var m string
	m, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_VMODULE")
	if err != nil {
		return
	}
	err = vmodule.Set(m)
	return
}
Example #2
0
func loggingOpts(logDir string, logToStderr bool, logLevel int, moduleSpec string) (dir vlog.LogDir, toStderr vlog.LogToStderr, level vlog.Level, vmodule vlog.ModuleSpec, err error) {
	dir = vlog.LogDir(logDir)
	toStderr = vlog.LogToStderr(logToStderr)
	level = vlog.Level(logLevel)
	err = vmodule.Set(moduleSpec)
	return
}