code: func writeValue(w io.Writer, v interface{}) (err error) {
  	switch v := v.(type) {
  	case nil:
  		_, err = w.Write([]byte("null"))
  	case string:
  		if strings.IndexFunc(v, needsQuotedValueRune) != -1 {
  			var b []byte
  			b, err = json.Marshal(v)
  			if err == nil {
  				w.Write(b)
  			}
  		} else {
  			_, err = w.Write([]byte(v))
  		}
  	case error:
  		s := v.Error()
  		err = writeValue(w, s)
  	default:
  		s := fmt.Sprint(v)
  		err = writeValue(w, s)
  	}
  	return
  }
docs: // writeValue writes a value on the writer in a logfmt compatible way