Skip to content

Commit

Permalink
[patch] update dependency versions (#45)
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
Yusuke Kato authored May 28, 2019
1 parent 4ade2cc commit c194c05
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions glg.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"strings"
"sync"
"sync/atomic"
"time"
"unsafe"

"github.com/kpango/fastime"
Expand Down Expand Up @@ -103,6 +104,8 @@ const (

// Default Format
df = "%v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v " +
"%v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v " +
"%v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v " +
"%v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v %v "

dfl = len(df) / 3
Expand Down Expand Up @@ -569,12 +572,14 @@ func (g *Glg) HTTPLogger(name string, handler http.Handler) http.Handler {
// HTTPLoggerFunc is simple http access logger
func (g *Glg) HTTPLoggerFunc(name string, hf http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := fastime.Now()
start := fastime.UnixNanoNow()

hf(w, r)

start -= fastime.UnixNanoNow()

err := g.Logf("Method: %s\tURI: %s\tName: %s\tTime: %s",
r.Method, r.RequestURI, name, fastime.Now().Sub(start).String())
r.Method, r.RequestURI, name, (*(*time.Duration)(unsafe.Pointer(&start))).String())

if err != nil {
err = g.Error(err)
Expand Down

0 comments on commit c194c05

Please sign in to comment.