logpolicy: actually collect panics

(Written with Josh)

For #2544

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw
2021-07-28 15:17:31 -07:00
committed by Josh Bleecher Snyder
parent 7298e777d4
commit 3e039daf95
3 changed files with 41 additions and 1 deletions

View File

@@ -435,9 +435,12 @@ func New(collection string) *Policy {
c.HTTPC = &http.Client{Transport: newLogtailTransport(u.Host)}
}
filchBuf, filchErr := filch.New(filepath.Join(dir, cmdName), filch.Options{})
filchBuf, filchErr := filch.New(filepath.Join(dir, cmdName), filch.Options{
ReplaceStderr: true,
})
if filchBuf != nil {
c.Buffer = filchBuf
c.Stderr = filchBuf.OrigStderr
}
lw := logtail.NewLogger(c, log.Printf)
log.SetFlags(0) // other logflags are set on console, not here