mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 12:16:44 +02:00
logtail: add Enable to allow re-enabling log uploads
Disable() was a one-way latch that could never be reversed. Add Enable() so that when the control plane (e.g., Headscale) disabled logging via MapResponse.Debug.DisableLogTail, it can be re-enabled when switching to a different control server. This is a prerequisite for tracking DisableLogTail per-instance on LocalBackend rather than as irreversible global state.
This commit is contained in:
parent
ac74dfa5cd
commit
da7d38f5fa
@ -589,11 +589,20 @@ func (lg *Logger) ExpVar() expvar.Var {
|
||||
// logtailDisabled is whether logtail uploads to logcatcher are disabled.
|
||||
var logtailDisabled atomic.Bool
|
||||
|
||||
// Disable disables logtail uploads for the lifetime of the process.
|
||||
// Disable disables logtail uploads. If the disable was initiated by the
|
||||
// control plane (not the user), it can be reversed by calling Enable.
|
||||
func Disable() {
|
||||
logtailDisabled.Store(true)
|
||||
}
|
||||
|
||||
// Enable re-enables logtail uploads that were previously disabled via
|
||||
// Disable. This is used when the control plane (not the user) had
|
||||
// disabled logging and the client is switching to a different control
|
||||
// server.
|
||||
func Enable() {
|
||||
logtailDisabled.Store(false)
|
||||
}
|
||||
|
||||
var debugWakesAndUploads = envknob.RegisterBool("TS_DEBUG_LOGTAIL_WAKES")
|
||||
|
||||
// tryDrainWake tries to send to lg.drainWake, to cause an uploading wakeup.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user