Skip to content

Commit 9e615a2

Browse files
committed
Merge pull request ipfs/kubo#733 from jbenet/cleaner-output
logs: removed all log.Errors unhelpful to users This commit was moved from ipfs/kubo@e24f169
2 parents a01f266 + 2397dc5 commit 9e615a2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

gateway/core/corehttp/gateway_handler.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
155155
errmsg = errmsg + "bad request for " + r.URL.Path
156156
}
157157
w.Write([]byte(errmsg))
158-
log.Error(errmsg)
158+
log.Debug(errmsg)
159159
}
160160

161161
func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
@@ -174,7 +174,6 @@ func (i *gatewayHandler) getHandler(w http.ResponseWriter, r *http.Request) {
174174
w.WriteHeader(http.StatusBadRequest)
175175
}
176176

177-
log.Error(err)
178177
w.Write([]byte(err.Error()))
179178
return
180179
}
@@ -290,7 +289,7 @@ func (i *gatewayHandler) putHandler(w http.ResponseWriter, r *http.Request) {
290289
urlPath := r.URL.Path
291290
pathext := urlPath[5:]
292291
var err error
293-
if urlPath == IpfsPathPrefix + "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn/" {
292+
if urlPath == IpfsPathPrefix+"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn/" {
294293
i.putEmptyDirHandler(w, r)
295294
return
296295
}
@@ -326,7 +325,7 @@ func (i *gatewayHandler) putHandler(w http.ResponseWriter, r *http.Request) {
326325
err = fmt.Errorf("Cannot override existing object")
327326
w.WriteHeader(http.StatusBadRequest)
328327
w.Write([]byte(err.Error()))
329-
log.Error("%s", err)
328+
log.Debug("%s", err)
330329
return
331330
}
332331

@@ -450,15 +449,15 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
450449

451450
func webErrorWithCode(w http.ResponseWriter, message string, err error, code int) {
452451
w.WriteHeader(code)
453-
log.Errorf("%s: %s", message, err)
452+
log.Debugf("%s: %s", message, err)
454453
w.Write([]byte(message + ": " + err.Error()))
455454
}
456455

457456
// return a 500 error and log
458457
func internalWebError(w http.ResponseWriter, err error) {
459458
w.WriteHeader(http.StatusInternalServerError)
460459
w.Write([]byte(err.Error()))
461-
log.Error("%s", err)
460+
log.Debug("%s", err)
462461
}
463462

464463
// Directory listing template

0 commit comments

Comments
 (0)