shippingservice: add logs indicating rpc calls

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-06-29 16:36:12 -07:00
parent 8c3d36d81e
commit 08aa1cce26

View file

@ -22,6 +22,8 @@ type server struct{}
// GetQuote produces a shipping quote (cost) in USD. // GetQuote produces a shipping quote (cost) in USD.
func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQuoteResponse, error) { func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQuoteResponse, error) {
log.Printf("[GetQuote] received request")
defer log.Printf("[GetQuote] completed request")
// 1. Our quote system requires the total number of items to be shipped. // 1. Our quote system requires the total number of items to be shipped.
count := 0 count := 0
@ -45,6 +47,8 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ
// ShipOrder mocks that the requested items will be shipped. // ShipOrder mocks that the requested items will be shipped.
// It supplies a tracking ID for notional lookup of shipment delivery status. // It supplies a tracking ID for notional lookup of shipment delivery status.
func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.ShipOrderResponse, error) { func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.ShipOrderResponse, error) {
log.Printf("[ShipOrder] received request")
defer log.Printf("[ShipOrder] completed request")
// 1. Create a Tracking ID // 1. Create a Tracking ID
baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress, in.Address.City, in.Address.State) baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress, in.Address.City, in.Address.State)
id := CreateTrackingId(baseAddress) id := CreateTrackingId(baseAddress)