summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/macaron.v1/logger.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/macaron.v1/logger.go')
-rw-r--r--vendor/gopkg.in/macaron.v1/logger.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/gopkg.in/macaron.v1/logger.go b/vendor/gopkg.in/macaron.v1/logger.go
index add6049072..34178d78a6 100644
--- a/vendor/gopkg.in/macaron.v1/logger.go
+++ b/vendor/gopkg.in/macaron.v1/logger.go
@@ -19,6 +19,7 @@ import (
"fmt"
"log"
"net/http"
+ "reflect"
"runtime"
"time"
)
@@ -32,6 +33,14 @@ func init() {
ColorLog = runtime.GOOS != "windows"
}
+// LoggerInvoker is an inject.FastInvoker wrapper of func(ctx *Context, log *log.Logger).
+type LoggerInvoker func(ctx *Context, log *log.Logger)
+
+func (invoke LoggerInvoker) Invoke(params []interface{}) ([]reflect.Value, error) {
+ invoke(params[0].(*Context), params[1].(*log.Logger))
+ return nil, nil
+}
+
// Logger returns a middleware handler that logs the request as it goes in and the response as it goes out.
func Logger() Handler {
return func(ctx *Context, log *log.Logger) {
@@ -42,7 +51,7 @@ func Logger() Handler {
rw := ctx.Resp.(ResponseWriter)
ctx.Next()
- content := fmt.Sprintf("%s: Completed %s %v %s in %v", time.Now().Format(LogTimeFormat), ctx.Req.RequestURI, rw.Status(), http.StatusText(rw.Status()), time.Since(start))
+ content := fmt.Sprintf("%s: Completed %s %s %v %s in %v", time.Now().Format(LogTimeFormat), ctx.Req.Method, ctx.Req.RequestURI, rw.Status(), http.StatusText(rw.Status()), time.Since(start))
if ColorLog {
switch rw.Status() {
case 200, 201, 202: