cmd/present: add request address to logged errors
Change-Id: I504d29d7196b8c61cff5e92bb4244a34c9c41fa8 Reviewed-on: https://go-review.googlesource.com/24331 Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
a2a552218a
commit
8b3828f1c8
|
@ -8,6 +8,7 @@ import (
|
|||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -37,7 +38,11 @@ func dirHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
if isDir, err := dirList(w, name); err != nil {
|
||||
log.Println(err)
|
||||
addr, _, e := net.SplitHostPort(r.RemoteAddr)
|
||||
if e != nil {
|
||||
addr = r.RemoteAddr
|
||||
}
|
||||
log.Printf("request from %s: %s", addr, err)
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
} else if isDir {
|
||||
|
|
Loading…
Reference in New Issue