logpolicy, various: allow overriding log function

This allows sending logs from the "logpolicy" package (and associated
callees) to something other than the log package. The behaviour for
tailscaled remains the same, passing in log.Printf

Updates #8249

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ie1d43b75fa7281933d9225bffd388462c08a5f31
This commit is contained in:
Andrew Dunham
2023-07-10 15:45:57 -04:00
parent cd313e410b
commit 60ab8089ff
6 changed files with 70 additions and 48 deletions

View File

@@ -114,7 +114,7 @@ func NewLogger(logdir string, logf logger.Logf, logID logid.PublicID, netMon *ne
logger := &Logger{
logf: logf,
filch: filch,
tr: logpolicy.NewLogtailTransport(logtail.DefaultHost, netMon),
tr: logpolicy.NewLogtailTransport(logtail.DefaultHost, netMon, logf),
}
logger.logger = logtail.NewLogger(logtail.Config{
BaseURL: logpolicy.LogURL(),