summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/http.go b/http.go
index bdf7ab3..37546fd 100644
--- a/http.go
+++ b/http.go
@@ -49,14 +49,16 @@ func whoSent(r *http.Request) string {
}
func logReqPB(pb *httppb.HttpRequest) {
- log.Info("LOG: httppb.HttpRequest Errors START:")
- log.Info(strings.Join(pb.Errors, "\n"))
- log.Info("LOG: httppb.HttpRequest Errors END")
+ log.Info("LOG: httppb.HttpRequest START:")
+ for i, line := range strings.Join(pb.Log, "\n") {
+ log.Infof("\t%d %s\n", i, line)
+ }
+ log.Info("LOG: httppb.HttpRequest END")
}
func okHandler(w http.ResponseWriter, r *http.Request) {
reqPB, err := httppb.ReqToPB(r)
- reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("START: Got %d bytes from the client", len(reqPB.Body)))
+ reqPB.Log = append(reqPB.Log, fmt.Sprintf("START: Got %d bytes from the client", len(reqPB.ClientData)))
if err != nil {
log.Info("something crazy err", err)
}
@@ -85,7 +87,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(route, "/repos/") {
pb, err := makeReposPB(reqPB)
if err != nil {
- reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
+ reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
}
result := gitpb.NewRepos()
switch route {
@@ -110,7 +112,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(route, "/patches/") {
pb, err := makePatchesPB(reqPB)
if err != nil {
- reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
+ reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
}
result := forgepb.NewPatches()
switch route {
@@ -141,7 +143,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(route, "/patchsets/") {
pb, err := makePatchsetsPB(reqPB)
if err != nil {
- reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
+ reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
}
result := forgepb.NewPatchsets()
switch route {
@@ -153,7 +155,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if err := result.SendReply(w, reqPB); err != nil {
log.Info("Oh well, Send to client failed. err =", err)
}
- log.Info("Send to client seems to have worked. errors:", reqPB.Errors)
+ log.Info("Send to client seems to have worked. log:", reqPB.Log)
me.forge.SavePatchsets()
// todo: logReq(reqPB)
logReqPB(reqPB)