// Printing function purely for debugging purposes
// Print the body of a request to the console
500218
func printBody(r io.ReadCloser) {
	body, err := ioutil.ReadAll(r)
	bodyString := string(body)

	if err != nil {
		fmt.Println(err)
	}

	fmt.Println(bodyString)
}
883091
func (t *Tree) Print() {
	if t.Root == nil {
		fmt.Println("<nil>")
	}
	t.Root.print()
}
208372
func (p *Pretty) Println(i interface{}) {
	p.PrintValue(r.ValueOf(i), 0)
	io.WriteString(p.Out, "\n")
}
341742
func Print(err error, out io.Writer) {
	switch specific := err.(type) {
	case *HereError:
		out.Write([]byte(" from: " + specific.FullLocation() + "\n"))
		Print(specific.error, out)
	case *CauseError:
		Print(specific.error, out)
		out.Write([]byte("cause: " + specific.cause.Error() + "\n"))

		if cause, ok := specific.cause.(*CauseError); ok {
			for {
				out.Write([]byte("cause: " + cause.cause.Error() + "\n"))

				if sub, ok := cause.cause.(*CauseError); ok {
					cause = sub
				} else {
					break
				}
			}
		}
	case *TraceError:
		Print(specific.error, out)
		out.Write([]byte("trace:\n" + specific.trace))

	default:
		out.Write([]byte("error: " + err.Error() + "\n"))
	}
}
1132748
func (p *ProgressBar) Print() {
	if p.PrependTextFunc != nil {
		p.PrependText = p.PrependTextFunc(p)
	}
	pct := p.percentage()
	clearCurrentLine()

	pcts := fmt.Sprintf("%.2f%%", pct*100)
	for len(pcts) < 7 {
		pcts = " " + pcts
	}

	tiWidth, _, _ := terminal.GetSize(int(syscall.Stdin))
	if tiWidth < 0 {
		// we're not running inside a real terminal (e.g. CI)
		// we assume a width of 80
		tiWidth = 80
	}
	barWidth := uint(math.Min(float64(p.Width), float64(tiWidth)/2.0))

	size := int(barWidth) - len(pcts) - 4
	fill := int(math.Max(2, math.Floor((float64(size)*pct)+.5)))
	if size < 16 {
		barWidth = 0
	}

	text := p.Text
	textLen := utf8.RuneCountInString(p.Text)
	maxTextWidth := tiWidth - 3 - int(barWidth) - utf8.RuneCountInString(p.PrependText)
	if maxTextWidth < 0 {
		maxTextWidth = 0
	}
	if textLen > maxTextWidth {
		if textLen-maxTextWidth+3 < textLen {
			text = "..." + string([]rune(p.Text)[textLen-maxTextWidth+3:])
		} else {
			text = ""
		}
	}

	// Print text
	s := fmt.Sprintf("%s%s  %s ",
		text,
		strings.Repeat(" ", maxTextWidth-utf8.RuneCountInString(text)),
		p.PrependText)
	fmt.Fprint(Stdout, s)

	if barWidth > 0 {
		progChar := BarFormat[2]
		if p.Current == p.Total {
			progChar = BarFormat[1]
		}

		// Print progress bar
		fmt.Fprintf(Stdout, "%c%s%c%s%c %s",
			BarFormat[0],
			strings.Repeat(string(BarFormat[1]), fill-1),
			progChar,
			strings.Repeat(string(BarFormat[3]), size-fill),
			BarFormat[4],
			pcts)
	}
}
368027
func printMethod(method *Methodx, out *os.File, serviceName string, methodName string, objectFuncToObject map[string]string) {

	actualResponses := filterResponses(method.Responses, methodName)
	// Generate Description
	if method.Description != "" {
		fmt.Fprintln(out, formatComment("", method.Description, method.Parameters))
	}
	fmt.Fprint(out, "func (obj *", serviceName, ") ", methodName, "(ctx context.Context")

	// Generate Parameters
	for _, param := range method.Parameters {
		fmt.Fprint(out, ", ", "", toParamName(param.Name), " ", getTypeName(param))
	}
	fmt.Fprint(out, ") ")

	// Generate Return Types
	if len(actualResponses) > 0 {
		fmt.Fprint(out, "(")
	}
	for _, response := range actualResponses {
		typeName := getTypeName(response)
		if typeName == "*ObjectInterface" {
			// Replace the generic ObjectInterface pointer with the right Remote Object API struct
			objectTypeName := objectFuncToObject[serviceName+"."+methodName]
			if objectTypeName == "" {
				panic("Unknown remote object type for " + serviceName + "." + methodName)
			}
			fmt.Fprint(out, "*"+objectTypeName, ", ")
		} else {
			fmt.Fprint(out, getTypeName(response), ", ")
		}

	}
	fmt.Fprint(out, "error")
	if len(actualResponses) > 0 {
		fmt.Fprint(out, ")")
	}

	// Generate Start of Function body
	fmt.Fprintln(out, " {")

	// Generate an anonymous result container struct
	var resultParamName string
	if len(method.Responses) > 0 {
		fmt.Fprintln(out, "\tresult := &struct {")
		for _, response := range method.Responses {
			fmt.Fprintln(out, "\t\t"+toPublicMemberName(response.Name), getTypeName(response)+"\t`json:\""+response.Name+"\"`")
		}
		fmt.Fprintln(out, "\t} {}")
		resultParamName = "result"
	} else {
		resultParamName = "nil"
	}

	// Generate the actual call down to the RPC machinery
	fmt.Fprint(out, "\terr := obj.rpc(ctx, \"", methodName, "\", ", resultParamName)
	for _, param := range method.Parameters {
		// Fill in the parameters in the parameter array
		fmt.Fprint(out, ", ", toParamName(param.Name))
	}
	fmt.Fprintln(out, ")")

	// If there is at least one Remote Object that will be created then check for nil and return early
	if atLeastOneObjectInterface(method) {
		fmt.Fprintln(out, "\tif err != nil {")
		fmt.Fprint(out, "\t\treturn ")
		for _, response := range actualResponses {
			fmt.Fprint(out, nilNameInEarlyReturnAfterError(response.Type)+", ")
		}
		fmt.Fprintln(out, "err")
		fmt.Fprintln(out, "\t}")
	}

	fmt.Fprint(out, getExtraCrossAssignmentLine(methodName))

	// Return the result including creating a new Remote Object if needed
	fmt.Fprint(out, "\treturn ")
	for _, response := range actualResponses {
		if getTypeName(response) == "*ObjectInterface" {
			objectAPITypeName := objectFuncToObject[serviceName+"."+methodName]
			fmt.Fprint(out, "&"+objectAPITypeName+"{obj.session.getRemoteObject(result."+response.Name[1:]+")}, ")
		} else {
			fmt.Fprint(out, "result."+toPublicMemberName(response.Name)+", ")
		}
	}
	fmt.Fprintln(out, "err ")
	fmt.Fprintln(out, "}")
	fmt.Fprintln(out, "")
}
158141
func (db *GoLevelDB) Print() {
	str, _ := db.db.GetProperty("leveldb.stats")
	fmt.Printf("%v\n", str)

	itr := db.db.NewIterator(nil, nil)
	for itr.Next() {
		key := itr.Key()
		value := itr.Value()
		fmt.Printf("[%X]:\t[%X]\n", key, value)
	}
}
141908
func (mp *MultiProgressBar) Print() {
	moveCursorUp(uint(len(mp.ProgressBars)))

	for _, p := range mp.ProgressBars {
		moveCursorDown(1)
		p.Print()
	}
}
643573
func Print(program string) string {
	m := map[string]string{
		"program":   program,
		"version":   Version,
		"revision":  Revision,
		"branch":    Branch,
		"buildUser": BuildUser,
		"buildDate": BuildDate,
		"goVersion": GoVersion,
	}
	t := template.Must(template.New("version").Parse(versionInfoTmpl))

	var buf bytes.Buffer
	if err := t.ExecuteTemplate(&buf, "version", m); err != nil {
		panic(err)
	}
	return strings.TrimSpace(buf.String())
}
152532
func (s Server) Print() {
	log.Println("Server Configuration:")
	log.Printf("\tListening:%s:%v\n", s.BindHost, s.BindPort)
	log.Printf("\tNamespace:%s\n", s.Namespace)
	log.Printf("\tService Name:%s\n", s.ServiceName)
	log.Printf("\tAuth Token:%s\n", s.AuthToken)
	log.Printf("\tClear Namespaces?:%v\n", s.ClearNamespaces)
}
97014
func (l *Logger) Print(v ...interface{}) {
	l.print(DisableLevel, fmt.Sprint(v...), l.NewLine)
}
161776
func (p *Printer) Print(obj runtime.Object, w io.Writer) error {
	if obj == nil {
		return nil
	}
	data, err := yaml.Marshal(obj)
	if err != nil {
		return err
	}
	_, err = w.Write(data)
	return err

}
318288
func (n *node) print(w io.Writer, level int) {
	fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat("  ", level), n.items)
	for _, c := range n.children {
		c.print(w, level+1)
	}
}
443700
func (db *MemDB) Print() {
	db.mtx.Lock()
	defer db.mtx.Unlock()

	for key, value := range db.db {
		fmt.Printf("[%X]:\t[%X]\n", []byte(key), value)
	}
}
183768
func Print(node Node) string {
	visitor := newPrintVisitor()
	node.Accept(visitor)
	return visitor.output()
}
417462
func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
	if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
		return fmt.Errorf(InternalObjectPrinterErr)
	}

	var data []byte
	var err error
	data, err = json.Marshal(obj)
	if err != nil {
		return err
	}

	out := map[string]interface{}{}
	if err := json.Unmarshal(data, &out); err != nil {
		return err
	}
	if err = p.safeExecute(w, out); err != nil {
		// It is way easier to debug this stuff when it shows up in
		// stdout instead of just stdin. So in addition to returning
		// a nice error, also print useful stuff with the writer.
		fmt.Fprintf(w, "Error executing template: %v. Printing more information for debugging the template:\n", err)
		fmt.Fprintf(w, "\ttemplate was:\n\t\t%v\n", p.rawTemplate)
		fmt.Fprintf(w, "\traw data was:\n\t\t%v\n", string(data))
		fmt.Fprintf(w, "\tobject given to template engine was:\n\t\t%+v\n\n", out)
		return fmt.Errorf("error executing template %q: %v", p.rawTemplate, err)
	}
	return nil
}
859046
func print(v interface{}) string {
	switch vt := v.(type) {
	case Map:
		return vt.String()
	case Slice:
		return vt.String()
	case BSON:
		return fmt.Sprintf("BSON(%v)", vt)
	case Float:
		return fmt.Sprintf("Float(%v)", vt)
	case String:
		return fmt.Sprintf("String(%v)", vt)
	case Array:
		wr := bytes.NewBuffer(nil)
		fmt.Fprint(wr, "Array([")
		for i, vtv := range vt {
			fmt.Fprint(wr, print(vtv))
			if i != len(vt)-1 {
				fmt.Fprint(wr, " ")
			}
		}
		fmt.Fprintf(wr, "])")
		return wr.String()
	case Binary:
		return fmt.Sprintf("Binary(%v)", vt)
	case Undefined:
		return "Undefined()"
	case ObjectId:
		return fmt.Sprintf("ObjectId(%v)", vt)
	case Bool:
		return fmt.Sprintf("Bool(%v)", vt)
	case UTCDateTime:
		return fmt.Sprintf("UTCDateTime(%v)", time.Unix(0, int64(vt)*1000*1000))
	case Null:
		return "Null()"
	case Regexp:
		return fmt.Sprintf("Regexp(Pattern(%v) Options(%v))", vt.Pattern, vt.Options)
	case DBPointer:
		return fmt.Sprintf("DBPointer(Name(%v) ObjectId(%v))", vt.Name, vt.ObjectId)
	case Javascript:
		return fmt.Sprintf("Javascript(%v)", vt)
	case Symbol:
		return fmt.Sprintf("Symbol(%v)", vt)
	case JavascriptScope:
		return fmt.Sprintf("JavascriptScope(Javascript(%v) Scope(%v))", vt.Javascript, vt.Scope)
	case Int32:
		return fmt.Sprintf("Int32(%v)", vt)
	case Timestamp:
		return fmt.Sprintf("Timestamp(%v)", vt)
	case Int64:
		return fmt.Sprintf("Int64(%v)", vt)
	case MinKey:
		return "MinKey()"
	case MaxKey:
		return "MaxKey()"
	}
	return fmt.Sprint(v)
}