feat(GODT-3195): add OS info to the log.

This commit is contained in:
Xavier Michelon 2024-01-10 08:32:43 +01:00
parent 5751166ebc
commit 2895f42a64
1 changed files with 13 additions and 0 deletions

View File

@ -44,6 +44,7 @@ import (
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
"github.com/ProtonMail/proton-bridge/v3/pkg/keychain"
"github.com/ProtonMail/proton-bridge/v3/pkg/restarter"
"github.com/elastic/go-sysinfo"
"github.com/pkg/profile"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
@ -378,6 +379,18 @@ func withLogging(c *cli.Context, crashHandler *crash.Handler, locations *locatio
WithField("offset", now.Format("-07:00:00")).
Info("Time zone info")
host, err := sysinfo.Host()
if err != nil {
logrus.WithError(err).Error("Could not retrieve operating system info")
} else {
osInfo := host.Info().OS
logrus.
WithField("name", osInfo.Name).
WithField("version", osInfo.Version).
WithField("build", osInfo.Build).
Info("Operating system info")
}
return fn(closer)
}