github.com/koko1123/flow-go-1@v0.29.6/utils/logging/json.go (about)

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