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)
|
||||
website, err := getWebsite(r.Host)
|
||||
if err != nil {
|
||||
logger.Warn("website not found: ", r.Host)
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
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() {
|
||||
logger.Warn("website not found: ", r.Host)
|
||||
logger.Info("done")
|
||||
http.ServeFile(w, r, path)
|
||||
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)
|
||||
if f, err := os.Stat(path); err == nil && !f.IsDir() {
|
||||
logger.Info("done")
|
||||
http.ServeFile(w, r, path)
|
||||
return
|
||||
}
|
||||
|
|
Reference in New Issue