mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
various: pass logger.Logf through to more places
Updates #7537 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Id89acab70ea678c8c7ff0f44792d54c7223337c6
This commit is contained in:
@@ -384,6 +384,7 @@ func (f *forwarder) getKnownDoHClientForProvider(urlBase string) (c *http.Client
|
||||
dialer := dnscache.Dialer(nsDialer.DialContext, &dnscache.Resolver{
|
||||
SingleHost: dohURL.Hostname(),
|
||||
SingleHostStaticResult: allIPs,
|
||||
Logf: f.logf,
|
||||
})
|
||||
c = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
|
@@ -250,10 +250,13 @@ func SetCachePath(path string) {
|
||||
// logfunc stores the logging function to use for this package.
|
||||
var logfunc syncs.AtomicValue[logger.Logf]
|
||||
|
||||
// SetLogger sets the logging function that this package will use. The default
|
||||
// logger if this function is not called is 'log.Printf'.
|
||||
func SetLogger(log logger.Logf) {
|
||||
logfunc.Store(log)
|
||||
// SetLogger sets the logging function that this package will use, and returns
|
||||
// the old value (which may be nil).
|
||||
//
|
||||
// If this function is never called, or if this function is called with a nil
|
||||
// value, 'log.Printf' will be used to print logs.
|
||||
func SetLogger(log logger.Logf) (old logger.Logf) {
|
||||
return logfunc.Swap(log)
|
||||
}
|
||||
|
||||
func logf(format string, args ...any) {
|
||||
|
Reference in New Issue
Block a user