mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-17 12:09:58 +00:00
Thread cacheDir through NewClient -> RunOniOS -> MobileDependency.TempDir so the iOS client can pass its sandbox-writable cache directory for debug bundle zip file creation instead of os.TempDir(). Move log collection into platform-dispatched addPlatformLog(): - iOS: adds the file-based Go client log (with rotation, stderr/stdout companions and anonymization handled by addLogfile) plus the Swift app log (swift-log.log) written by the iOS app into the same log directory - Other non-Android platforms: existing file-based log + systemd fallback Narrow the debug_nonandroid.go build tag to !android && !ios so iOS no longer attempts the systemd journal fallback. Add a DebugBundle() entry point to the iOS Go client that generates a bundle, uploads it and returns the upload key. It works with or without a running engine: when the engine is up it reuses the live config, sync response and client metrics; otherwise it loads the config from disk (or the preloaded tvOS config). Guard the live config/ConnectClient behind a state mutex since DebugBundle may run on a different thread.
26 lines
532 B
Go
26 lines
532 B
Go
//go:build !android && !ios
|
|
|
|
package debug
|
|
|
|
import (
|
|
"slices"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/netbirdio/netbird/util"
|
|
)
|
|
|
|
func (g *BundleGenerator) addPlatformLog() error {
|
|
if g.logPath != "" && !slices.Contains(util.SpecialLogs, g.logPath) {
|
|
if err := g.addLogfile(); err != nil {
|
|
log.Errorf("failed to add log file to debug bundle: %v", err)
|
|
if err := g.trySystemdLogFallback(); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else if err := g.trySystemdLogFallback(); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|