func Init()

in internal/clilog/log.go [34:83]


func Init(debug bool, print bool, noOutput bool, suppressWarnings bool) {
	debugHandle := io.Discard
	infoHandle := io.Discard
	var warningHandle, errorHandle, responseHandle io.Writer

	if debug {
		debugHandle = os.Stdout
	}

	if print {
		infoHandle = os.Stdout
	}

	if noOutput {
		responseHandle = io.Discard
		infoHandle = io.Discard
		errorHandle = io.Discard
		warningHandle = io.Discard
	} else {
		responseHandle = os.Stdout
		// see https://github.com/kubernetes/kubeadm/issues/2632
		warningHandle = os.Stderr
		errorHandle = os.Stderr
	}

	if suppressWarnings {
		warningHandle = io.Discard
	}

	Debug = log.New(debugHandle,
		"DEBUG: ",
		log.Ldate|log.Ltime|log.Lshortfile)

	Info = log.New(infoHandle,
		"", 0)

	Warning = log.New(warningHandle,
		"WARNING: ",
		log.Ldate|log.Ltime|log.Lshortfile)

	Error = log.New(errorHandle,
		"ERROR: ",
		log.Ldate|log.Ltime|log.Lshortfile)

	HTTPResponse = log.New(responseHandle,
		"", 0)

	HTTPError = log.New(errorHandle,
		"", 0)
}