// print json file (such as patch file) content for debugging
496531
func printJson(out io.Writer, file []byte) error {
	diff := make(map[string]interface{})
	if err := json.Unmarshal(file, &diff); err != nil {
		return err
	}
	fmt.Fprintf(out, "%v\n", diff)
	return nil
}
576962
func (p *MJPEGPrinter) Print(r io.Reader, fps int) error {
	showCursor(p.w, false)
	defer showCursor(p.w, true)
	go p.handleInterrupt()

	reader := mjpegStreamer{
		r:   r,
		fps: fps,
	}

	for frame := range reader.ReadAll() {
		if frame.err != nil {
			return frame.err
		}

		frame.img = redraw(frame.img, p.c.Filter, p.c.Drawer)

		// Draw the image and reset the cursor
		if err := flush(p.w, frame.img, p.c.Flusher); err != nil {
			return err
		}
		rows := frame.img.Bounds().Dy() / 4
		if frame.img.Bounds().Dy()%4 != 0 {
			rows++
		}

		resetCursor(p.w, rows)
	}

	return nil
}
688729
func (dbg DebugPrinter) Print(v ...interface{}) {
	if dbg.Enabled {
		fmt.Fprint(dbg.out, v...)
	}
}
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)
}
182630
func PrintFilesOrFail(files []string, err error) {
	FailOnError(err)
	fmt.Println(strings.Join(files, "\n"))
}
851107
func ReadJSONConfigFromFile(filename string, argv interface{}) error {
	file, err := os.Open(filename)
	if err == nil {
		defer file.Close()
		err = ReadJSON(file, argv)
	} else {
		exe, e := os.Executable()
		if e != nil {
			return e
		}
		// allow self-config .json files to go with the executable file, #40
		file, err = os.Open(filepath.Dir(exe) + string(filepath.Separator) + filename)
		if err == nil {
			defer file.Close()
			err = ReadJSON(file, argv)
		}
	}
	return err
}
839316
func JSONLoad(filename string, data interface{}) error {
	file, err := os.Open(filename + ".gz")
	defer file.Close()
	if err != nil {
		return err
	}
	gz, err := gzip.NewReader(file)
	if err != nil {
		return err
	}
	blob, err := ioutil.ReadAll(gz)
	if err != nil {
		return err
	}
	err = json.Unmarshal(blob, data)
	if err != nil {
		return err
	}
	return nil
}
91118
func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
	var queryObj interface{} = obj
	if meta.IsListType(obj) {
		data, err := json.Marshal(obj)
		if err != nil {
			return err
		}
		queryObj = map[string]interface{}{}
		if err := json.Unmarshal(data, &queryObj); err != nil {
			return err
		}
	}

	if err := j.JSONPath.Execute(w, queryObj); err != nil {
		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", j.rawTemplate)
		fmt.Fprintf(w, "\tobject given to jsonpath engine was:\n\t\t%#v\n\n", queryObj)
		return fmt.Errorf("error executing jsonpath %q: %v\n", j.rawTemplate, err)
	}
	return nil
}
331413
func JsonpToJson(json string) string {
	start := strings.Index(json, "{")
	end := strings.LastIndex(json, "}")
	start1 := strings.Index(json, "[")
	if start1 > 0 && start > start1 {
		start = start1
		end = strings.LastIndex(json, "]")
	}
	if end > start && end != -1 && start != -1 {
		json = json[start : end+1]
	}
	json = strings.Replace(json, "\\'", "", -1)
	regDetail, _ := regexp.Compile("([^\\s\\:\\{\\,\\d\"]+|[a-z][a-z\\d]*)\\s*\\:")
	return regDetail.ReplaceAllString(json, "\"$1\":")
}
339571
func Print(a ...interface{}) (int, error) {
	a = append(a, ResetCode)
	compileValues(&a)
	return fmt.Print(a...)
}
596017
func (l *Logger) Print(args ...interface{}) {
	l.logf(l.app, logLevelNotice, "", true, args...)
}
143383
func (e *Entry) Print() {
	fmt.Printf("DN: %s\n", e.DN)
	for _, attr := range e.Attributes {
		attr.Print()
	}
}
491345
func (a *Application) Patch(patchedApplication *Application) (*Application, *http.Response, []error) {
	o, err := json.Marshal(a)
	if err != nil {
		return nil, nil, []error{err}
	}

	p, err := json.Marshal(patchedApplication)
	if err != nil {
		return nil, nil, []error{err}
	}

	patch, err := jsonpatch.CreatePatch([]byte(o), []byte(p))
	if err != nil {
		fmt.Printf("Error creating JSON patch:%v", err)
		return nil, nil, []error{err}
	}

	patchBytes, err := json.Marshal(patch)
	if err != nil {
		return nil, nil, []error{err}
	}
	k := kumoru.New()

	k.Logger.Debugf("Patch string: %s", patchBytes)

	k.Patch(fmt.Sprintf("%s/v1/applications/%s", k.EndPoint.Application, a.UUID))
	k.TargetType = "json-patch+json"
	k.RawString = string(string(patchBytes))
	k.SignRequest(true)

	resp, body, errs := k.End()

	if len(errs) > 0 {
		return a, resp, errs
	}

	if resp.StatusCode >= 400 {
		errs = append(errs, fmt.Errorf("%s", resp.Status))
	}

	pApp := Application{}
	err = json.Unmarshal([]byte(body), &pApp)

	if err != nil {
		errs = append(errs, err)
		return a, resp, errs
	}

	return &pApp, resp, nil
}
394641
func (db *CLevelDB) Print() {
	itr := db.Iterator(nil, nil)
	defer itr.Close()
	for ; itr.Valid(); itr.Next() {
		key := itr.Key()
		value := itr.Value()
		fmt.Printf("[%X]:\t[%X]\n", key, value)
	}
}
1334596
func (n *DebugCapture) DumpJSON(data []byte, cpuPrefix string) {
	resp, err := n.getJSON(data, cpuPrefix)
	if err != nil {
		fmt.Println(fmt.Sprintf(`{"type":"debug_capture_error","message":%q}`, err.Error()))
		return
	}
	fmt.Println(resp)
}
369142
func Print(format string, args ...interface{}) {
	if len(args) == 0 {
		fmt.Fprintln(OutputWriter, format)
		return
	}
	fmt.Fprintf(OutputWriter, format+"\n", args...)
}
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())
}