feat(logging): a lot of progress on moving to new logging lib, #4590

This commit is contained in:
Torkel Ödegaard
2016-06-06 23:06:44 +02:00
parent 25899b72d2
commit 22778e6efd
18 changed files with 314 additions and 707 deletions
+8
View File
@@ -1,6 +1,7 @@
package middleware
import (
"fmt"
"strconv"
"strings"
@@ -23,6 +24,7 @@ type Context struct {
IsSignedIn bool
AllowAnonymous bool
Logger log.Logger
}
func GetContextHandler() macaron.Handler {
@@ -33,6 +35,7 @@ func GetContextHandler() macaron.Handler {
Session: GetSession(),
IsSignedIn: false,
AllowAnonymous: false,
Logger: log.New("context"),
}
// the order in which these are tested are important
@@ -48,6 +51,11 @@ func GetContextHandler() macaron.Handler {
initContextWithAnonymousUser(ctx) {
}
ctx.Logger = log.New("context", "user", ctx.UserId, "orgId", ctx.OrgId)
// set ctx in data array on the original context
c.Data["ctx"] = ctx
fmt.Printf("c: %v\n", c)
c.Map(ctx)
}
}