From 65b76df9269ce6148493c147b963b1dc0d32944f Mon Sep 17 00:00:00 2001 From: mcorbin Date: Thu, 4 Jul 2024 22:32:32 +0200 Subject: [PATCH] Better logging --- pkg/healthcheck/healthcheck.go | 6 +++--- pkg/pushgateway/metric.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/healthcheck/healthcheck.go b/pkg/healthcheck/healthcheck.go index 5a5a6a5..da26626 100644 --- a/pkg/healthcheck/healthcheck.go +++ b/pkg/healthcheck/healthcheck.go @@ -47,7 +47,7 @@ func InitTLSHealthcheck(healthcheck *aggregates.Healthcheck) { } func (s *Service) CreateHealthcheck(ctx context.Context, healthcheck *aggregates.Healthcheck) error { - s.logger.Debug(fmt.Sprintf("creating healthcheck %s", healthcheck.Name)) + s.logger.Info(fmt.Sprintf("creating healthcheck %s", healthcheck.Name)) interval, err := time.ParseDuration(healthcheck.Interval) if err != nil { return er.New("Invalid healthcheck interval", er.BadRequest, true) @@ -66,7 +66,7 @@ func (s *Service) CreateHealthcheck(ctx context.Context, healthcheck *aggregates } func (s *Service) UpdateHealthcheck(ctx context.Context, healthcheck *aggregates.Healthcheck) error { - s.logger.Debug(fmt.Sprintf("updating healthcheck %s", healthcheck.Name)) + s.logger.Info(fmt.Sprintf("updating healthcheck %s", healthcheck.Name)) err := validator.Validator.Struct(*healthcheck) if err != nil { return err @@ -97,7 +97,7 @@ func (s *Service) GetHealthcheckByName(ctx context.Context, name string) (*aggre } func (s *Service) DeleteHealthcheck(ctx context.Context, id string) error { - s.logger.Debug(fmt.Sprintf("deleting healthcheck %s", id)) + s.logger.Info(fmt.Sprintf("deleting healthcheck %s", id)) return s.store.DeleteHealthcheck(ctx, id) } diff --git a/pkg/pushgateway/metric.go b/pkg/pushgateway/metric.go index c76daff..c89d00b 100644 --- a/pkg/pushgateway/metric.go +++ b/pkg/pushgateway/metric.go @@ -16,7 +16,7 @@ func InitPushgatewayMetric(metric *aggregates.PushgatewayMetric) { } func (s *Service) CreateOrUpdatePushgatewayMetric(ctx context.Context, metric aggregates.PushgatewayMetric, cumulative bool) (string, error) { - s.logger.Debug(fmt.Sprintf("creating or updating metric %s", metric.Name)) + s.logger.Info(fmt.Sprintf("creating or updating metric %s", metric.Name)) return s.store.CreateOrUpdatePushgatewayMetric(ctx, metric, cumulative) } @@ -77,17 +77,17 @@ func (s *Service) PrometheusMetrics(ctx context.Context) (string, error) { } func (s *Service) DeleteMetricsByName(ctx context.Context, name string) error { - s.logger.Debug(fmt.Sprintf("deleting push gateway metric %s", name)) + s.logger.Info(fmt.Sprintf("deleting push gateway metric %s", name)) return s.store.DeleteMetricsByName(ctx, name) } func (s *Service) DeleteMetricByID(ctx context.Context, id string) error { - s.logger.Debug(fmt.Sprintf("deleting push gateway metric %s", id)) + s.logger.Info(fmt.Sprintf("deleting push gateway metric %s", id)) return s.store.DeleteMetricByID(ctx, id) } func (s *Service) DeleteAllPushgatewayMetrics(ctx context.Context) error { - s.logger.Debug("deleting all push gateway metrics") + s.logger.Info("deleting all push gateway metrics") return s.store.DeleteAllPushgatewayMetrics(ctx) }