github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/utils/logging/json.go (about)

     1  package logging
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  func AsJSON(v interface{}) []byte {
     9  	data, err := json.Marshal(v)
    10  	if err != nil {
    11  		panic(fmt.Sprintf("could not encode as JSON: %s", err))
    12  	}
    13  	return data
    14  }