mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
cmd/tailscale,ipn/ipnlocal: print debug component names
Make the 'tailscale debug component-logs' command print the component names for which extra logging can be turned on, for easier discoverability of debug functions. Updates #cleanup Co-authored-by: Paul Scott <paul@tailscale.com> Signed-off-by: Val <valerie@tailscale.com>
This commit is contained in:
@@ -386,7 +386,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
||||
b.logf("[unexpected] failed to wire up PeerAPI port for engine %T", e)
|
||||
}
|
||||
|
||||
for _, component := range debuggableComponents {
|
||||
for _, component := range ipn.DebuggableComponents {
|
||||
key := componentStateKey(component)
|
||||
if ut, err := ipn.ReadStoreInt(pm.Store(), key); err == nil {
|
||||
if until := time.Unix(ut, 0); until.After(b.clock.Now()) {
|
||||
@@ -404,11 +404,6 @@ type componentLogState struct {
|
||||
timer tstime.TimerController // if non-nil, the AfterFunc to disable it
|
||||
}
|
||||
|
||||
var debuggableComponents = []string{
|
||||
"magicsock",
|
||||
"sockstats",
|
||||
}
|
||||
|
||||
func componentStateKey(component string) ipn.StateKey {
|
||||
return ipn.StateKey("_debug_" + component + "_until")
|
||||
}
|
||||
@@ -440,7 +435,7 @@ func (b *LocalBackend) SetComponentDebugLogging(component string, until time.Tim
|
||||
}
|
||||
}
|
||||
}
|
||||
if setEnabled == nil || !slices.Contains(debuggableComponents, component) {
|
||||
if setEnabled == nil || !slices.Contains(ipn.DebuggableComponents, component) {
|
||||
return fmt.Errorf("unknown component %q", component)
|
||||
}
|
||||
timeUnixOrZero := func(t time.Time) int64 {
|
||||
|
Reference in New Issue
Block a user