Пример #1
0
func enableLoggly(addr string, cloudConfigCA string, instanceId string,
	version string, revisionDate string) {

	client, err := util.PersistentHTTPClient(cloudConfigCA, addr)
	if err != nil {
		log.Errorf("Could not create HTTP client, not logging to Loggly: %v", err)
		removeLoggly()
		return
	}

	if addr == "" {
		log.Debugf("Sending error logs to Loggly directly")
	} else {
		log.Debugf("Sending error logs to Loggly via proxy at %v", addr)
	}

	lang, _ := jibber_jabber.DetectLanguage()
	logglyWriter := &logglyErrorWriter{
		lang:            lang,
		tz:              time.Now().Format("MST"),
		versionToLoggly: fmt.Sprintf("%v (%v)", version, revisionDate),
		client:          loggly.New(logglyToken),
	}
	logglyWriter.client.Defaults["hostname"] = "hidden"
	logglyWriter.client.Defaults["instanceid"] = instanceId
	if osStr, err := osversion.GetHumanReadable(); err == nil {
		osVersion = osStr
	}
	logglyWriter.client.SetHTTPClient(client)
	addLoggly(logglyWriter)
}
Пример #2
0
func main() {
	// checkNetwork runs only once when the app first loads.
	app.Main(func(a app.App) {
		str, err := osversion.GetString()
		if err != nil {
			log.Println("Error")
		}
		log.Println(str)

		str, err = osversion.GetHumanReadable()
		if err != nil {
			log.Println("Error")
		}
		log.Println(str)
	})
}
Пример #3
0
func main() {
	str, err := osversion.GetString()
	if err != nil {
		log.Fatalf("Error getting OS version: %v", err)
	}
	log.Println(str)

	version, err := osversion.GetSemanticVersion()
	if err != nil {
		log.Fatalf("Error getting OS version: %v", err)
	}

	log.Println(version)

	hstr, err := osversion.GetHumanReadable()
	if err != nil {
		log.Fatalf("Error getting OS version: %v", err)
	}

	log.Println(hstr)
}