Skip to content

Commit

Permalink
Fix logging string formatting (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jharrington22 authored and fahlmant committed Aug 15, 2019
1 parent d474fd2 commit e3209b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package metrics

import (
"fmt"
"net/http"

"github.com/prometheus/client_golang/prometheus"
Expand All @@ -28,7 +29,7 @@ func StartMetrics(config metricsConfig) {
}

http.Handle(config.metricsPath, prometheus.Handler())
log.Info("Port: %v", config.metricsPort)
log.Info(fmt.Sprintf("Port: %s", config.metricsPort))
metricsPort := ":" + (config.metricsPort)
go http.ListenAndServe(metricsPort, nil)
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/metrics/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package metrics

import (
"context"
"fmt"
"strconv"

monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
Expand Down Expand Up @@ -222,11 +223,11 @@ func createOrUpdateService(ctx context.Context, client client.Client, s *v1.Serv
log.Info("Error creating service object", "Error", err)
return nil, err
}
log.Info("Metrics Service object updated Service.Name %v and Service.Namespace %v", s.Name, s.Namespace)
log.Info(fmt.Sprintf("Metrics Service object updated Service.Name %v and Service.Namespace %v", s.Name, s.Namespace))
return existingService, nil
}

log.Info("Metrics Service object created Service.Name %v and Service.Namespace %v", s.Name, s.Namespace)
log.Info(fmt.Sprintf("Metrics Service object created Service.Name %v and Service.Namespace %v", s.Name, s.Namespace))
return s, nil
}

Expand All @@ -249,7 +250,7 @@ func createOrUpdateRoute(ctx context.Context, client client.Client, r *routev1.R
log.Info("Error creating metrics route", "Error", err.Error())
return nil, err
}
log.Info("Metrics Route object updated Route.Name %v and Route.Namespace %v", r.Name, r.Namespace)
log.Info(fmt.Sprintf("Metrics Route object updated Route.Name %v and Route.Namespace %v", r.Name, r.Namespace))
return existingRoute, nil
}

Expand Down

0 comments on commit e3209b8

Please sign in to comment.