logtail: add Logger.PrivateID accessor

For the control plane to use.

Change-Id: I0f02321fc4fa3a41c3ece3b51eee729ea9770905
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/4183/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent 36b148c2d2
commit 5f529d1359

@ -84,6 +84,7 @@ func NewLogger(cfg Config, logf tslogger.Logf) *Logger {
cfg.Buffer = NewMemoryBuffer(pendingSize)
}
l := &Logger{
privateID: cfg.PrivateID,
stderr: cfg.Stderr,
stderrLevel: int64(cfg.StderrLevel),
httpc: cfg.HTTPC,
@ -133,6 +134,7 @@ type Logger struct {
uploadCancel func()
explainedRaw bool
metricsDelta func() string // or nil
privateID PrivateID
shutdownStart chan struct{} // closed when shutdown begins
shutdownDone chan struct{} // closed when shutdown complete
@ -153,6 +155,11 @@ func (l *Logger) SetLinkMonitor(lm *monitor.Mon) {
l.linkMonitor = lm
}
// PrivateID returns the logger's private log ID.
//
// It exists for internal use only.
func (l *Logger) PrivateID() PrivateID { return l.privateID }
// Shutdown gracefully shuts down the logger while completing any
// remaining uploads.
//

Loading…
Cancel
Save