Skip to content

Commit

Permalink
Merge pull request #2086 from weaveworks/log-request-headers
Browse files Browse the repository at this point in the history
Add flag for logging headers
  • Loading branch information
jml authored Dec 14, 2016
2 parents a1d9db8 + a8ba7b2 commit 3560bbc
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 145 deletions.
5 changes: 4 additions & 1 deletion prog/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ func appMain(flags appFlags) {

handler := router(collector, controlRouter, pipeRouter, flags.externalUI)
if flags.logHTTP {
handler = middleware.LogFailed.Wrap(handler)
handler = middleware.Log{
LogRequestHeaders: flags.logHTTPHeaders,
LogSuccess: false,
}.Wrap(handler)
}

server := &graceful.Server{
Expand Down
14 changes: 8 additions & 6 deletions prog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ type probeFlags struct {
}

type appFlags struct {
window time.Duration
listen string
stopTimeout time.Duration
logLevel string
logPrefix string
logHTTP bool
window time.Duration
listen string
stopTimeout time.Duration
logLevel string
logPrefix string
logHTTP bool
logHTTPHeaders bool

weaveEnabled bool
weaveAddr string
Expand Down Expand Up @@ -298,6 +299,7 @@ func main() {
flag.StringVar(&flags.app.logLevel, "app.log.level", "info", "logging threshold level: debug|info|warn|error|fatal|panic")
flag.StringVar(&flags.app.logPrefix, "app.log.prefix", "<app>", "prefix for each log line")
flag.BoolVar(&flags.app.logHTTP, "app.log.http", false, "Log individual HTTP requests")
flag.BoolVar(&flags.app.logHTTPHeaders, "app.log.httpHeaders", false, "Log HTTP headers. Needs app.log.http to be enabled.")

flag.StringVar(&flags.app.weaveAddr, "app.weave.addr", app.DefaultWeaveURL, "Address on which to contact WeaveDNS")
flag.StringVar(&flags.app.weaveHostname, "app.weave.hostname", app.DefaultHostname, "Hostname to advertise in WeaveDNS")
Expand Down
135 changes: 0 additions & 135 deletions vendor/github.com/weaveworks/common/logging/event.go

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@
"importpath": "github.com/weaveworks/common",
"repository": "https://github.com/weaveworks/common",
"vcs": "git",
"revision": "cc20acf03ebf74be0facaae4259dff6cde01ce77",
"revision": "139d0313ac15170e9de8187b26e7df03b4cb910e",
"branch": "master",
"notests": true
},
Expand Down

0 comments on commit 3560bbc

Please sign in to comment.