func Debug()

in whisk/trace.go [66:85]


func Debug(dl DebugLevel, msgFormat string, args ...interface{}) {
	if isDebug {
		pc, file, line, _ := runtime.Caller(1)
		fcn := runtime.FuncForPC(pc)
		msg := fmt.Sprintf(msgFormat, args...)
		fcnName := fcn.Name()

		// Cobra command Run/RunE functions are anonymous, so the function name is unfriendly;
		// use the file name instead
		if strings.Contains(fcnName, "commands.glob.") || strings.Contains(fcnName, "whisk.glob.") {
			fcnName = file
		}

		// Only interested in the the trailing function/file name characters
		if len(fcnName) > MaxNameLen {
			fcnName = fcnName[len(fcnName)-MaxNameLen:]
		}
		fmt.Printf("[%-25s]:%03d:[%3s] %v", fcnName, line, dl, msg)
	}
}