Skip to content

Commit

Permalink
minor logging & httpapi fixes. Closes #230. Closes #228. (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
mthenw committed Aug 7, 2017
1 parent 9ac22e3 commit 740e76e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions functions/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func (f *Functions) DeleteFunction(id FunctionID) error {
if err != nil {
return &ErrorNotFound{id}
}

f.Log.Debug("Function deleted.", zap.String("functionId", string(id)))

return nil
}

Expand Down
2 changes: 2 additions & 0 deletions functions/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,6 @@ func (h HTTPAPI) deleteFunction(w http.ResponseWriter, r *http.Request, params h

encoder.Encode(&httpapi.Error{Error: err.Error()})
}

w.WriteHeader(http.StatusNoContent)
}
1 change: 1 addition & 0 deletions pubsub/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (h HTTPAPI) deleteSubscription(w http.ResponseWriter, r *http.Request, para
}
encoder.Encode(&httpapi.Error{Error: err.Error()})
}

w.WriteHeader(http.StatusNoContent)
}

Expand Down
6 changes: 3 additions & 3 deletions targetcache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newFunctionCache(log *zap.Logger) *functionCache {
func (c *functionCache) Set(k string, v []byte) {
f := &functions.Function{}
err := json.NewDecoder(bytes.NewReader(v)).Decode(f)
c.log.Debug("Function cache received set key.", zap.String("key", k), zap.String("value", string(v)))
c.log.Debug("Function local cache received value update.", zap.String("key", k), zap.String("value", string(v)))
if err != nil {
c.log.Error("Could not deserialize Function state!", zap.Error(err), zap.String("key", k))
} else {
Expand Down Expand Up @@ -93,7 +93,7 @@ func newEndpointCache(log *zap.Logger) *endpointCache {
func (c *endpointCache) Set(k string, v []byte) {
e := &pubsub.Endpoint{}
err := json.NewDecoder(bytes.NewReader(v)).Decode(e)
c.log.Debug("Endpoint cache received set key.", zap.String("key", k), zap.String("value", string(v)))
c.log.Debug("Endpoint local cache received value update.", zap.String("key", k), zap.String("value", string(v)))
if err != nil {
c.log.Error("Could not deserialize Endpoint state!", zap.Error(err), zap.String("key", k))
} else {
Expand Down Expand Up @@ -127,7 +127,7 @@ func newSubscriptionCache(log *zap.Logger) *subscriptionCache {
func (c *subscriptionCache) Set(k string, v []byte) {
s := pubsub.Subscription{}
err := json.NewDecoder(bytes.NewReader(v)).Decode(&s)
c.log.Debug("Subscription cache received set key.", zap.String("key", k), zap.String("value", string(v)))
c.log.Debug("Subscription local cache received value update.", zap.String("key", k), zap.String("value", string(v)))
if err != nil {
c.log.Error("Could not deserialize Subscription state!", zap.Error(err), zap.String("key", k))
return
Expand Down

0 comments on commit 740e76e

Please sign in to comment.