tsnet: expose logtail's Logf method (#17057)

This commit adds a new method to the tsnet.Server type named `Logger`
that returns the underlying logtail instance's Logf method.

This is intended to be used within the Kubernetes operator to wrap its
existing logger in a way such that operator specific logs can also be
sent to control for support & debugging purposes.

Updates https://github.com/tailscale/corp/issues/32037

Signed-off-by: David Bond <davidsbond93@gmail.com>
This commit is contained in:
David Bond
2025-09-12 12:04:39 +01:00
committed by GitHub
parent a1dcf12b67
commit cfb2ca724b

View File

@@ -492,6 +492,16 @@ func (s *Server) TailscaleIPs() (ip4, ip6 netip.Addr) {
return ip4, ip6 return ip4, ip6
} }
// Logtailf returns a [logger.Logf] that outputs to Tailscale's logging service and will be only visible to Tailscale's
// support team. Logs written there cannot be retrieved by the user. This method always returns a non-nil value.
func (s *Server) Logtailf() logger.Logf {
if s.logtail == nil {
return logger.Discard
}
return s.logtail.Logf
}
func (s *Server) getAuthKey() string { func (s *Server) getAuthKey() string {
if v := s.AuthKey; v != "" { if v := s.AuthKey; v != "" {
return v return v