Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Commit

Permalink
errors: remove unused client field, properly close logger
Browse files Browse the repository at this point in the history
Fixes googleapis#717.

Change-Id: Ic7215b6e0f79058dee28a18997106808dfbf3d50
Reviewed-on: https://code-review.googlesource.com/15490
Reviewed-by: Jaana Burcu Dogan <[email protected]>
  • Loading branch information
tmc authored and rakyll committed Aug 3, 2017
1 parent efa9bc7 commit 5317d48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions errors/error_logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,12 @@ func TestReportfUsingLogging(t *testing.T) {
t.Errorf("error report didn't contain formatted message")
}
}

func TestCloseUsingLogging(t *testing.T) {
fl := &fakeLogger{}
c := newTestClientUsingLogging(fl)
err := c.Close()
if err != nil {
t.Fatal(err)
}
}
3 changes: 1 addition & 2 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ type loggingSender struct {
logger loggerInterface
projectID string
serviceContext map[string]string
client *logging.Client
}

// Client represents a Google Cloud Error Reporting client.
Expand Down Expand Up @@ -387,7 +386,7 @@ func (s *loggingSender) send(ctx context.Context, r *http.Request, message strin
}

func (s *loggingSender) close() error {
return s.client.Close()
return s.logger.Close()
}

func (s *errorApiSender) send(ctx context.Context, r *http.Request, message string) {
Expand Down

0 comments on commit 5317d48

Please sign in to comment.