cloudflare/cloudflared
Publicmirrored from https://github.com/cloudflare/cloudflaredAvailable
cmd/cloudflared/buildinfo/build_info.go
28lines · modecode
| 1 | package buildinfo |
| 2 | |
| 3 | import ( |
| 4 | "runtime" |
| 5 | |
| 6 | "github.com/sirupsen/logrus" |
| 7 | ) |
| 8 | |
| 9 | type BuildInfo struct { |
| 10 | GoOS string `json:"go_os"` |
| 11 | GoVersion string `json:"go_version"` |
| 12 | GoArch string `json:"go_arch"` |
| 13 | CloudflaredVersion string `json:"cloudflared_version"` |
| 14 | } |
| 15 | |
| 16 | func GetBuildInfo(cloudflaredVersion string) *BuildInfo { |
| 17 | return &BuildInfo{ |
| 18 | GoOS: runtime.GOOS, |
| 19 | GoVersion: runtime.Version(), |
| 20 | GoArch: runtime.GOARCH, |
| 21 | CloudflaredVersion: cloudflaredVersion, |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func (bi *BuildInfo) Log(logger *logrus.Logger) { |
| 26 | logger.Infof("Version %s", bi.CloudflaredVersion) |
| 27 | logger.Infof("GOOS: %s, GOVersion: %s, GoArch: %s", bi.GoOS, bi.GoVersion, bi.GoArch) |
| 28 | } |
| 29 | |