Logging
This commit is contained in:
parent
45577f3ff3
commit
713f91a844
|
@ -1,4 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
tag=git.woozle.org/neale/wallart-server
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
docker build -t wallart-server -f build/Dockerfile .
|
docker build -t $tag -f build/Dockerfile .
|
||||||
|
docker push $tag
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"image/png"
|
"image/png"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -106,7 +106,15 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintln(w, "It worked")
|
log.Println("New image successfully uploaded")
|
||||||
|
}
|
||||||
|
|
||||||
|
func logRequestHandler(h http.Handler) http.Handler {
|
||||||
|
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("%s %s %s", r.RemoteAddr, r.Method, r.URL)
|
||||||
|
h.ServeHTTP(w, r)
|
||||||
|
}
|
||||||
|
return http.HandlerFunc(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -120,5 +128,5 @@ func main() {
|
||||||
http.Handle("/wallart.bin", http.FileServer(cacheDir))
|
http.Handle("/wallart.bin", http.FileServer(cacheDir))
|
||||||
http.Handle("/wallart.png", http.FileServer(cacheDir))
|
http.Handle("/wallart.png", http.FileServer(cacheDir))
|
||||||
http.Handle("/", http.FileServer(http.Dir(*web)))
|
http.Handle("/", http.FileServer(http.Dir(*web)))
|
||||||
http.ListenAndServe(*listen, nil)
|
http.ListenAndServe(*listen, logRequestHandler(http.DefaultServeMux))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
html {
|
html {
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
background-color: #333;
|
||||||
|
color: #ddd;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,4 +9,8 @@ img#wallart {
|
||||||
max-width: 90vw;
|
max-width: 90vw;
|
||||||
width: 320px;
|
width: 320px;
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #ccf;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue