package pretty

import (
	"encoding/json"
	"fmt"
)

func Print(v interface{}) {
	buf, _ := json.MarshalIndent(v, "", "   ")
	fmt.Print(string(buf))
}

func Sprint(v interface{}) string {
	buf, _ := json.MarshalIndent(v, "", "   ")
	return string(buf)
}

func Println(v interface{}) {
	buf, _ := json.MarshalIndent(v, "", "   ")
	fmt.Println(string(buf))
}

func Sprintln(v interface{}) string {
	buf, _ := json.MarshalIndent(v, "", "   ")
	return fmt.Sprintln(string(buf))
}

func PPrint(prefix string, v interface{}) {
	buf, _ := json.MarshalIndent(v, "", "   ")
	fmt.Printf("%s: %s", prefix, buf)
}

func PSprint(prefix string, v interface{}) string {
	buf, _ := json.MarshalIndent(v, "", "   ")
	return fmt.Sprintf("%s: %s", prefix, buf)
}

func PPrintln(prefix string, v interface{}) {
	buf, _ := json.MarshalIndent(v, "", "   ")
	fmt.Printf("%s: %s\n", prefix, buf)
}

func PSprintln(prefix string, v interface{}) string {
	buf, _ := json.MarshalIndent(v, "", "   ")
	return fmt.Sprintf("%s: %s\n", prefix, buf)
}
