mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
63b3c82587
There is an undocumented 16KiB limit for text log messages. However, the limit for JSON messages is 256KiB. Even worse, logging JSON as text results in significant overhead since each double quote needs to be escaped. Instead, use logger.Logf.JSON to explicitly log the info as JSON. We also modify osdiag to return the information as structured data rather than implicitly have the package log on our behalf. This gives more control to the caller on how to log. Updates #7802 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
21 lines
752 B
Go
21 lines
752 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// Package osdiag provides loggers for OS-specific diagnostic information.
|
|
package osdiag
|
|
|
|
// LogSupportInfoReason is an enumeration indicating the reason for logging
|
|
// support info.
|
|
type LogSupportInfoReason int
|
|
|
|
const (
|
|
LogSupportInfoReasonStartup LogSupportInfoReason = iota + 1 // tailscaled is starting up.
|
|
LogSupportInfoReasonBugReport // a bugreport is in the process of being gathered.
|
|
)
|
|
|
|
// SupportInfo obtains OS-specific diagnostic information for troubleshooting
|
|
// and support. The reason governs the verbosity of the output.
|
|
func SupportInfo(reason LogSupportInfoReason) map[string]any {
|
|
return supportInfo(reason)
|
|
}
|