func (j *jsonEncoder) Encode(msg *message.Message, redactedMsg []byte) ([]byte, error) {
	ts := time.Now().UTC()
	if !msg.Timestamp.IsZero() {
		ts = msg.Timestamp
	}
	return json.Marshal(jsonPayload{
		Message:   toValidUtf8(redactedMsg),
		Status:    msg.GetStatus(),
		Timestamp: ts.UnixNano() / nanoToMillis,
		Hostname:  msg.GetHostname(),
		Service:   msg.Origin.Service(),
		Source:    msg.Origin.Source(),
		Tags:      msg.Origin.TagsToString(),
	})
}
// Encode encodes a message into a JSON byte array.
Encode encodes a message into a JSON byte array.
// Encode encodes a message into a JSON byte array .
func (j *jsonEncoder) Encode(msg *message.Message, redactedMsg []byte) ([]byte, error) {
	ts := time.Now().UTC()
	if !msg.Timestamp.IsZero() {
		ts = msg.Timestamp
	}
	return json.Marshal(jsonPayload{
		Message:   toValidUtf8(redactedMsg),
		Status:    msg.GetStatus(),
		Timestamp: ts.UnixNano() / nanoToMillis,
		Hostname:  msg.GetHostname(),
		Service:   msg.Origin.Service(),
		Source:    msg.Origin.Source(),
		Tags:      msg.Origin.TagsToString(),
	})
}
func ( j * jsonEncoder ) Encode ( msg * message . Message , redactedMsg [ ] byte ) ( [ ] byte , error ) { ts := time . Now ( ) . UTC ( ) if ! msg . Timestamp . IsZero ( ) { ts = msg . Timestamp } return json . Marshal ( jsonPayload { Message : toValidUtf8 ( redactedMsg ) , Status : msg . GetStatus ( ) , Timestamp : ts . UnixNano ( ) / nanoToMillis , Hostname : msg . GetHostname ( ) , Service : msg . Origin . Service ( ) , Source : msg . Origin . Source ( ) , Tags : msg . Origin . TagsToString ( ) , } ) }
Encode encodes a message into a JSON byte array.
Encode encodes a message into a JSON byte array .