Skip to content
Permalink
Browse files

add log stage field to all logs, not just request-level

  • Loading branch information...
tj committed Mar 1, 2018
1 parent 0f0416a commit 017f7cfb3fd81baf1c749003368cac5db20c4776
Showing with 1 addition and 1 deletion.
  1. +1 −0 cmd/up-proxy/main.go
  2. +0 −1 http/logs/logs.go
@@ -24,6 +24,7 @@ func main() {
if s := os.Getenv("LOG_LEVEL"); s != "" {
log.SetLevelFromString(s)
}
log.Log = log.WithField("stage", stage)
log.Info("initializing")

// read config
@@ -63,7 +63,6 @@ func New(c *up.Config, next http.Handler) (http.Handler, error) {
// logContext returns the common log context for a request.
func logContext(r *http.Request) log.Interface {
return ctx.WithFields(log.Fields{
"stage": r.Header.Get("X-Stage"),
"id": r.Header.Get("X-Request-Id"),
"method": r.Method,
"path": r.URL.Path,

0 comments on commit 017f7cf

Please sign in to comment.
You can’t perform that action at this time.