From ddedd5f1b5814dc3934a7622775d64d502c76e19 Mon Sep 17 00:00:00 2001 From: Rob Best Date: Thu, 10 Sep 2020 07:35:44 +0100 Subject: [PATCH] Add more information to error logs (#49) --- ssl_exporter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssl_exporter.go b/ssl_exporter.go index bd93cd6..2429aff 100644 --- a/ssl_exporter.go +++ b/ssl_exporter.go @@ -75,7 +75,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { state, err := e.prober(e.target, e.module, e.timeout) if err != nil { - log.Errorln(err) + log.Errorf("error=%s target=%s prober=%s timeout=%s", err, e.target, e.module.Prober, e.timeout) ch <- prometheus.MustNewConstMetric( tlsConnectSuccess, prometheus.GaugeValue, 0, ) @@ -90,7 +90,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { // Retrieve certificates from the connection state peerCertificates := state.PeerCertificates if len(peerCertificates) < 1 { - log.Errorln("No certificates found in connection state for " + e.target) + log.Errorf("error=No certificates found in connection state. target=%s prober=%s", e.target, e.module.Prober) ch <- prometheus.MustNewConstMetric( tlsConnectSuccess, prometheus.GaugeValue, 0, )