removed 'internal' directory
This commit is contained in:
parent
8c200a5a6c
commit
65709049d7
42 changed files with 35 additions and 44 deletions
13
logging/error.go
Normal file
13
logging/error.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func ErrorPage(err error, status int) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(status)
|
||||
fmt.Fprint(w, err.Error())
|
||||
}
|
||||
}
|
||||
16
logging/logger.go
Normal file
16
logging/logger.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Middleware(in http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
fmt.Println(r.Method, r.URL.String())
|
||||
in.ServeHTTP(w, r)
|
||||
fmt.Println(r.Method, "finished in", time.Since(start))
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue