mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
tstest: document PanicOnLog
This commit is contained in:
parent
e6d0c92b1d
commit
5ec7ac1d02
@ -29,13 +29,15 @@ func UnfixLogs(t *testing.T) {
|
||||
defer log.SetOutput(os.Stderr)
|
||||
}
|
||||
|
||||
type panicLogWriter struct {
|
||||
}
|
||||
|
||||
func (w *panicLogWriter) Write(b []byte) (int, error) {
|
||||
panic("please use tailscale.com/logger.Logf instead of the log module")
|
||||
type panicLogWriter struct{}
|
||||
|
||||
func (panicLogWriter) Write(b []byte) (int, error) {
|
||||
panic("please use tailscale.com/logger.Logf instead of the log package")
|
||||
}
|
||||
|
||||
// PanicOnLog modifies the standard library log package's default output to
|
||||
// an io.Writer that panics, to root out code that's not plumbing their logging
|
||||
// through explicit tailscale.com/logger.Logf paths.
|
||||
func PanicOnLog() {
|
||||
log.SetOutput(&panicLogWriter{})
|
||||
log.SetOutput(panicLogWriter{})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user