sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0

fix logging

This commit is contained in:
Martin Geno 2016-12-29 07:53:27 +01:00
parent 166e8791bb
commit 69d05d28df
1 changed files with 3 additions and 1 deletions

View File

@ -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
}