Remove debug logging

This commit is contained in:
James Mills 2016-09-22 23:52:01 +10:00
parent 4f2a87b748
commit e01d34d7a2
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
1 changed files with 1 additions and 26 deletions

View File

@ -810,9 +810,7 @@ func cleanPath(p string) string {
// Most-specific (longest) pattern wins // Most-specific (longest) pattern wins
func (mux *ServeMux) match(selector string) (h Handler, pattern string) { func (mux *ServeMux) match(selector string) (h Handler, pattern string) {
var n = 0 var n = 0
log.Printf("selector: %q", selector)
for k, v := range mux.m { for k, v := range mux.m {
log.Printf("k: %q v: %q", k, v)
if !selectorMatch(k, selector) { if !selectorMatch(k, selector) {
continue continue
} }
@ -843,7 +841,6 @@ func (mux *ServeMux) handler(selector string) (h Handler, pattern string) {
defer mux.mu.RUnlock() defer mux.mu.RUnlock()
h, pattern = mux.match(selector) h, pattern = mux.match(selector)
log.Printf("found handler %q with pattern %q", h, pattern)
if h == nil { if h == nil {
h, pattern = NotFoundHandler(), "" h, pattern = NotFoundHandler(), ""
} }
@ -991,13 +988,11 @@ func (w *response) WriteInfo(msg string) error {
} }
func (w *response) WriteItem(i Item) error { func (w *response) WriteItem(i Item) error {
log.Printf("WriteItem: %q", i)
if w.rt == 0 { if w.rt == 0 {
w.rt = 2 w.rt = 2
} }
if w.rt != 2 { if w.rt != 2 {
log.Printf("Ooops!")
return errors.New("cannot write directory data to a document") return errors.New("cannot write directory data to a document")
} }
@ -1007,13 +1002,11 @@ func (w *response) WriteItem(i Item) error {
} }
b, err := i.MarshalText() b, err := i.MarshalText()
log.Printf("b: %q err: %q", b, err)
if err != nil { if err != nil {
return err return err
} }
n, err := w.w.Write(b) _, err = w.w.Write(b)
log.Printf("n: %q err: %q", n, err)
if err != nil { if err != nil {
return err return err
} }
@ -1142,22 +1135,9 @@ type File interface {
} }
func dirList(w ResponseWriter, r *Request, f File, fs FileSystem) { func dirList(w ResponseWriter, r *Request, f File, fs FileSystem) {
log.Printf("dirList: %s", f)
root := fs.Name() root := fs.Name()
log.Printf("root: %q", root)
/*
fileinfo, err := f.Stat()
if err != nil {
// TODO: log err.Error() to the Server.ErrorLog, once it's possible
// for a handler to get at its Server via the ResponseWriter.
Error(w, "Error reading directory")
return
}
*/
fullpath := f.(*os.File).Name() fullpath := f.(*os.File).Name()
log.Printf("fullpath: %s", fullpath)
files, err := f.Readdir(-1) files, err := f.Readdir(-1)
if err != nil { if err != nil {
@ -1168,10 +1148,7 @@ func dirList(w ResponseWriter, r *Request, f File, fs FileSystem) {
} }
sort.Sort(byName(files)) sort.Sort(byName(files))
log.Printf("reading %d files", len(files))
for _, file := range files { for _, file := range files {
log.Printf("file: %q", file.Name())
if file.Name()[0] == '.' { if file.Name()[0] == '.' {
continue continue
} }
@ -1226,7 +1203,6 @@ func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
// name is '/'-separated, not filepath.Separator. // name is '/'-separated, not filepath.Separator.
func serveFile(w ResponseWriter, r *Request, fs FileSystem, name string) { func serveFile(w ResponseWriter, r *Request, fs FileSystem, name string) {
log.Printf("serveFile: ...")
const gophermapFile = "/gophermap" const gophermapFile = "/gophermap"
f, err := fs.Open(name) f, err := fs.Open(name)
@ -1263,7 +1239,6 @@ func serveFile(w ResponseWriter, r *Request, fs FileSystem, name string) {
return return
} }
log.Printf("serving file: %s", d.Name())
serveContent(w, r, f) serveContent(w, r, f)
} }