Skip to content

Commit

Permalink
Merge pull request #693 from nmeyerhans/tcs-logging
Browse files Browse the repository at this point in the history
Update tcshandler logging for seelog.
  • Loading branch information
nmeyerhans authored Feb 2, 2017
2 parents 7219a65 + d179457 commit 95dd837
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions agent/tcs/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ const (
func StartMetricsSession(params TelemetrySessionParams) {
disabled, err := params.isTelemetryDisabled()
if err != nil {
log.Warn("Error getting telemetry config", "err", err)
log.Warnf("Error getting telemetry config: %v", err)
return
}

if !disabled {
statsEngine := stats.NewDockerStatsEngine(params.Cfg, params.DockerClient, params.ContainerChangeEventStream)
err := statsEngine.MustInit(params.TaskEngine, params.Cfg.Cluster, params.ContainerInstanceArn)
if err != nil {
log.Warn("Error initializing metrics engine", "err", err)
log.Warnf("Error initializing metrics engine: %v", err)
return
}
err = StartSession(params, statsEngine)
if err != nil {
log.Warn("Error starting metrics session with backend", "err", err)
log.Warnf("Error starting metrics session with backend: %v", err)
return
}
} else {
Expand All @@ -76,7 +76,7 @@ func StartSession(params TelemetrySessionParams, statsEngine stats.Engine) error
if tcsError == nil || tcsError == io.EOF {
backoff.Reset()
} else {
log.Info("Error from tcs; backing off", "err", tcsError)
log.Infof("Error from tcs; backing off: %v", tcsError)
params.time().Sleep(backoff.Duration())
}
}
Expand All @@ -85,10 +85,10 @@ func StartSession(params TelemetrySessionParams, statsEngine stats.Engine) error
func startTelemetrySession(params TelemetrySessionParams, statsEngine stats.Engine) error {
tcsEndpoint, err := params.ECSClient.DiscoverTelemetryEndpoint(params.ContainerInstanceArn)
if err != nil {
log.Error("Unable to discover poll endpoint", "err", err)
log.Errorf("Unable to discover poll endpoint: ", err)
return err
}
log.Debug("Connecting to TCS endpoint " + tcsEndpoint)
log.Debugf("Connecting to TCS endpoint %v", tcsEndpoint)
url := formatURL(tcsEndpoint, params.Cfg.Cluster, params.ContainerInstanceArn)
return startSession(url, params.Cfg.AWSRegion, params.CredentialProvider, params.AcceptInvalidCert, statsEngine, defaultHeartbeatTimeout, defaultHeartbeatJitter, defaultPublishMetricsInterval, params.DeregisterInstanceEventStream)
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func startSession(url string, region string, credentialProvider *credentials.Cre
client.AddRequestHandler(ackPublishMetricHandler(timer))
err = client.Connect()
if err != nil {
log.Error("Error connecting to TCS: " + err.Error())
log.Errorf("Error connecting to TCS: %v", err.Error())
return err
}
return client.Serve()
Expand Down

0 comments on commit 95dd837

Please sign in to comment.