Skip to content

Commit

Permalink
Remove excessive logging
Browse files Browse the repository at this point in the history
Fixes #82
  • Loading branch information
johanbrandhorst committed Sep 26, 2019
1 parent 64c211f commit 200bb7b
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions certify.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,13 @@ func (c *Certify) init() {
// GetCertificate implements the GetCertificate TLS config hook.
func (c *Certify) GetCertificate(hello *tls.ClientHelloInfo) (cert *tls.Certificate, err error) {
c.initOnce.Do(c.init)
start := time.Now()
c.Logger.Debug("Getting server certificate", map[string]interface{}{
"server_name": hello.ServerName,
"remote_addr": hello.Conn.RemoteAddr().String(),
})
defer func() {
took := time.Since(start)
if err != nil {
c.Logger.Error("Error getting server certificate", map[string]interface{}{
"error": err.Error(),
})
return
}
c.Logger.Debug("Certificate found", map[string]interface{}{
"serial": cert.Leaf.SerialNumber.String(),
"took": took.String(),
})
}()

name := strings.ToLower(hello.ServerName)
Expand All @@ -110,20 +100,13 @@ func (c *Certify) GetCertificate(hello *tls.ClientHelloInfo) (cert *tls.Certific
// GetClientCertificate implements the GetClientCertificate TLS config hook.
func (c *Certify) GetClientCertificate(_ *tls.CertificateRequestInfo) (cert *tls.Certificate, err error) {
c.initOnce.Do(c.init)
start := time.Now()
c.Logger.Debug("Getting client certificate")
defer func() {
took := time.Since(start)
if err != nil {
c.Logger.Error("Error getting client certificate", map[string]interface{}{
"error": err.Error(),
})
return
}
c.Logger.Debug("Certificate found", map[string]interface{}{
"serial": cert.Leaf.SerialNumber.String(),
"took": took.String(),
})
}()
return c.getOrRenewCert(c.CommonName)
}
Expand Down

0 comments on commit 200bb7b

Please sign in to comment.