github.com/moleculer-go/moleculer@v0.3.3/util/log.go (about)

     1  package util
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  func PrettyPrintMap(data interface{}) string {
     9  	prettyData, err := json.MarshalIndent(data, "", "    ")
    10  	if err != nil {
    11  		return fmt.Sprintf("Error while pretty printing: %v", err)
    12  	}
    13  	return string(prettyData)
    14  }