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) }
func enableLoggly(addr string, cloudConfigCA string, instanceId string, version string, revisionDate string) { if addr == "" { log.Error("No known proxy, won't report to Loggly") removeLoggly() return } client, err := util.PersistentHTTPClient(cloudConfigCA, addr) if err != nil { log.Errorf("Could not create proxied HTTP client, not logging to Loggly: %v", err) removeLoggly() return } 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 logglyWriter.client.SetHTTPClient(client) addLoggly(logglyWriter) }