mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-30 11:35:32 -04:00
logtail: gate "logtail started" behind TS_DEBUG_LOGTAIL envknob (#19891)
Gates the unnecessary "logtail started" message behind the debug envknob TS_DEBUG_LOGTAIL. This is extra log spam that isn't needed unless we are debugging. Updates tailscale/corp#40908 Signed-off-by: James Scott <jim@tailscale.com>
This commit is contained in:
@@ -138,7 +138,9 @@ func NewLogger(cfg Config, logf tslogger.Logf) *Logger {
|
||||
logger.uploadCancel = cancel
|
||||
|
||||
go logger.uploading(ctx)
|
||||
logger.Write([]byte("logtail started"))
|
||||
if envknob.Bool("TS_DEBUG_LOGTAIL") {
|
||||
logger.Write([]byte("logtail started"))
|
||||
}
|
||||
return logger
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"time"
|
||||
|
||||
"github.com/go-json-experiment/json/jsontext"
|
||||
"tailscale.com/envknob"
|
||||
"tailscale.com/net/memnet"
|
||||
"tailscale.com/tstest"
|
||||
"tailscale.com/tstime"
|
||||
@@ -67,6 +68,8 @@ type LogtailTestServer struct {
|
||||
// *Logger whose HTTPC dials it. Lives inside the caller's synctest bubble so
|
||||
// the default FlushDelay and any other fake timers advance automatically.
|
||||
func newTestLogtailServer(t *testing.T) (*LogtailTestServer, *Logger) {
|
||||
// Enable the logtail started message
|
||||
envknob.Setenv("TS_DEBUG_LOGTAIL", "1")
|
||||
ts := &LogtailTestServer{
|
||||
// max channel backlog = 1 "started" + #logLines x "log line" + 1 "closed"
|
||||
uploaded: make(chan []byte, 2+logLines),
|
||||
|
||||
Reference in New Issue
Block a user