mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
logtail,logpolicy: tweak minor cosmetic things
Just reading the code again in prep for some alloc reductions. Change-Id: I065226ea794b7ec7144c2b15942d35131c9313a8 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
ab60f28227
commit
48e73e147a
@@ -520,7 +520,7 @@ func New(collection string) *Policy {
|
||||
}
|
||||
}
|
||||
|
||||
c := logtail.Config{
|
||||
conf := logtail.Config{
|
||||
Collection: newc.Collection,
|
||||
PrivateID: newc.PrivateID,
|
||||
Stderr: logWriter{console},
|
||||
@@ -534,16 +534,16 @@ func New(collection string) *Policy {
|
||||
HTTPC: &http.Client{Transport: NewLogtailTransport(logtail.DefaultHost)},
|
||||
}
|
||||
if collection == logtail.CollectionNode {
|
||||
c.MetricsDelta = clientmetric.EncodeLogTailMetricsDelta
|
||||
c.IncludeProcID = true
|
||||
c.IncludeProcSequence = true
|
||||
conf.MetricsDelta = clientmetric.EncodeLogTailMetricsDelta
|
||||
conf.IncludeProcID = true
|
||||
conf.IncludeProcSequence = true
|
||||
}
|
||||
|
||||
if val := getLogTarget(); val != "" {
|
||||
log.Println("You have enabled a non-default log target. Doing without being told to by Tailscale staff or your network administrator will make getting support difficult.")
|
||||
c.BaseURL = val
|
||||
conf.BaseURL = val
|
||||
u, _ := url.Parse(val)
|
||||
c.HTTPC = &http.Client{Transport: NewLogtailTransport(u.Host)}
|
||||
conf.HTTPC = &http.Client{Transport: NewLogtailTransport(u.Host)}
|
||||
}
|
||||
|
||||
filchOptions := filch.Options{
|
||||
@@ -566,16 +566,16 @@ func New(collection string) *Policy {
|
||||
|
||||
filchBuf, filchErr := filch.New(filchPrefix, filchOptions)
|
||||
if filchBuf != nil {
|
||||
c.Buffer = filchBuf
|
||||
conf.Buffer = filchBuf
|
||||
if filchBuf.OrigStderr != nil {
|
||||
c.Stderr = filchBuf.OrigStderr
|
||||
conf.Stderr = filchBuf.OrigStderr
|
||||
}
|
||||
}
|
||||
lw := logtail.NewLogger(c, log.Printf)
|
||||
lw := logtail.NewLogger(conf, log.Printf)
|
||||
|
||||
var logOutput io.Writer = lw
|
||||
|
||||
if runtime.GOOS == "windows" && c.Collection == logtail.CollectionNode {
|
||||
if runtime.GOOS == "windows" && conf.Collection == logtail.CollectionNode {
|
||||
logID := newc.PublicID.String()
|
||||
exe, _ := os.Executable()
|
||||
if strings.EqualFold(filepath.Base(exe), "tailscaled.exe") {
|
||||
|
Reference in New Issue
Block a user