fix logging
This commit is contained in:
parent
166e8791bb
commit
69d05d28df
|
@ -28,13 +28,14 @@ func handlerstatic(w http.ResponseWriter, r *http.Request) {
|
||||||
logger := liblog.NewModulLog(r.Host).GetLog(r, r.URL.Path)
|
logger := liblog.NewModulLog(r.Host).GetLog(r, r.URL.Path)
|
||||||
website, err := getWebsite(r.Host)
|
website, err := getWebsite(r.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logger.Warn("website not found: ", r.Host)
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
path := fmt.Sprintf("%s/%d/%s/%s", config.Webroot, website.ID, "static", r.URL.Path)
|
path := fmt.Sprintf("%s/%d/%s/%s", config.Webroot, website.ID, "static", r.URL.Path)
|
||||||
if f, err := os.Stat(path); err == nil && !f.IsDir() {
|
if f, err := os.Stat(path); err == nil && !f.IsDir() {
|
||||||
logger.Warn("website not found: ", r.Host)
|
logger.Info("done")
|
||||||
http.ServeFile(w, r, path)
|
http.ServeFile(w, r, path)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,7 @@ func handlerfiles(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
path := fmt.Sprintf("%s/%d/%s/%s", config.Webroot, website.ID, "files", r.URL.Path)
|
path := fmt.Sprintf("%s/%d/%s/%s", config.Webroot, website.ID, "files", r.URL.Path)
|
||||||
if f, err := os.Stat(path); err == nil && !f.IsDir() {
|
if f, err := os.Stat(path); err == nil && !f.IsDir() {
|
||||||
|
logger.Info("done")
|
||||||
http.ServeFile(w, r, path)
|
http.ServeFile(w, r, path)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue