aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-03-08 13:18:32 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-03-08 13:18:32 +0100
commitacd0caa5f79117ed85cf86de046932852c2de490 (patch)
tree088ce5951cdccedb92b39009a668287cbcb9f646
parent8240eedfec5f875dbeec25d50d4e307d1d606d72 (diff)
dashboard/app: log api method/client
Since we now don't have them in URL, log them explicitly.
-rw-r--r--dashboard/app/api.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go
index 33a2b488b..02ac5e0c5 100644
--- a/dashboard/app/api.go
+++ b/dashboard/app/api.go
@@ -85,7 +85,10 @@ func handleJSON(fn JSONHandler) http.Handler {
}
func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error) {
- ns, err := checkClient(c, r.PostFormValue("client"), r.PostFormValue("key"))
+ client := r.PostFormValue("client")
+ method := r.PostFormValue("method")
+ log.Infof(c, "api %q from %q", method, client)
+ ns, err := checkClient(c, client, r.PostFormValue("key"))
if err != nil {
log.Warningf(c, "%v", err)
return nil, fmt.Errorf("unauthorized request")
@@ -104,7 +107,6 @@ func handleAPI(c context.Context, r *http.Request) (reply interface{}, err error
return nil, fmt.Errorf("failed to ungzip payload: %v", err)
}
}
- method := r.PostFormValue("method")
handler := apiHandlers[method]
if handler != nil {
return handler(c, r, payload)