func LogEnabledResponse(rw http.ResponseWriter, v interface{}) {
	if el, ok := v.(EnableLogger); ok {
		out, err := el.ToLog()
		if err != nil {
			LogError(rw, err)
			return
		}
		if rl, ok := rw.(logging.ResponseLogger); ok {
			rl.WithFields(map[string]interface{}{
				"response": out,
			})
		} else {
			log.Println(out)
		}
	}
}
LogEnabledResponse log the response object if it implements the EnableLogger
interface.
package api
import (
	"encoding/json"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"github.com/smallstep/certificates/errs"
	"github.com/smallstep/certificates/logging"
	"google.golang.org/protobuf/encoding/protojson"
	"google.golang.org/protobuf/proto"
)
type EnableLogger interface {
	ToLog() (interface{}, error)
}
func LogError(rw http.ResponseWriter, err error) {
	if rl, ok := rw.(logging.ResponseLogger); ok {
		rl.WithFields(map[string]interface{}{
			"error": err,
		})
	} else {
		log.Println(err)
	}
}