...

Source file src/github.com/rs/zerolog/encoder_json.go

Documentation: github.com/rs/zerolog

     1  // +build !binary_log
     2  
     3  package zerolog
     4  
     5  // encoder_json.go file contains bindings to generate
     6  // JSON encoded byte stream.
     7  
     8  import (
     9  	"github.com/rs/zerolog/internal/json"
    10  )
    11  
    12  var (
    13  	_ encoder = (*json.Encoder)(nil)
    14  
    15  	enc = json.Encoder{}
    16  )
    17  
    18  func init() {
    19  	// using closure to reflect the changes at runtime.
    20  	json.JSONMarshalFunc = func(v interface{}) ([]byte, error) {
    21  		return InterfaceMarshalFunc(v)
    22  	}
    23  }
    24  
    25  func appendJSON(dst []byte, j []byte) []byte {
    26  	return append(dst, j...)
    27  }
    28  
    29  func decodeIfBinaryToString(in []byte) string {
    30  	return string(in)
    31  }
    32  
    33  func decodeObjectToStr(in []byte) string {
    34  	return string(in)
    35  }
    36  
    37  func decodeIfBinaryToBytes(in []byte) []byte {
    38  	return in
    39  }
    40  

View as plain text