Fix not found logging.
@@ -100,6 +100,10 @@ func builtinSimpleServerInstanceMethods() []*BuiltInMethodObject {
fileRoot, serveStatic := server.InstanceVariables.get("@file_root")
+ router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ log.Printf("%s %s %s %d\n", r.Method, r.URL.Path, r.Proto, 404)
+ })
+
if serveStatic && fileRoot.Class() != t.vm.objectClass.getClassConstant(nullClass) {
fr := fileRoot.(*StringObject).value
currentDir, _ := os.Getwd()
@@ -116,10 +120,6 @@ func builtinSimpleServerInstanceMethods() []*BuiltInMethodObject {
log.Fatalf("listen: %s\n", err)
}
- router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- log.Printf("%s %s %s %d\n", r.Method, r.URL.Path, r.Proto, 404)
- })
-
return receiver
}
},
