Browse Source

Logging tweaks

master
Chris Smith 5 years ago
parent
commit
e65933e339
3 changed files with 6 additions and 4 deletions
  1. 2
    0
      certs/monitor.go
  2. 3
    3
      docker/monitor.go
  3. 1
    1
      dotege.go

+ 2
- 0
certs/monitor.go View File

31
 }
31
 }
32
 
32
 
33
 func (c *CertificateMonitor) scanForFolders(dir string) {
33
 func (c *CertificateMonitor) scanForFolders(dir string) {
34
+	c.logger.Debugf("Scanning folder %s for certificates", dir)
34
 	dirs, err := ioutil.ReadDir(dir)
35
 	dirs, err := ioutil.ReadDir(dir)
35
 	if err != nil {
36
 	if err != nil {
36
 		c.logger.Errorf("Unable to read directory %s - %s", dir, err.Error())
37
 		c.logger.Errorf("Unable to read directory %s - %s", dir, err.Error())
45
 }
46
 }
46
 
47
 
47
 func (c *CertificateMonitor) scanForCerts(vhost string, dir string) {
48
 func (c *CertificateMonitor) scanForCerts(vhost string, dir string) {
49
+	c.logger.Debugf("Scanning folder %s for certificates for %s", dir, vhost)
48
 	files, err := ioutil.ReadDir(dir)
50
 	files, err := ioutil.ReadDir(dir)
49
 	if err != nil {
51
 	if err != nil {
50
 		c.logger.Errorf("Unable to read directory %s - %s", dir, err.Error())
52
 		c.logger.Errorf("Unable to read directory %s - %s", dir, err.Error())

+ 3
- 3
docker/monitor.go View File

104
 	now := time.Now()
104
 	now := time.Now()
105
 	expiryTime := now.Add(c.deletionTime)
105
 	expiryTime := now.Add(c.deletionTime)
106
 	c.expiryTimes[name] = expiryTime
106
 	c.expiryTimes[name] = expiryTime
107
-	c.logger.Info("Scheduling expiry timer for %s", name)
107
+	c.logger.Infof("Scheduling expiry timer for %s", name)
108
 	if c.nextExpiry.Before(now) || c.nextExpiry.After(expiryTime) {
108
 	if c.nextExpiry.Before(now) || c.nextExpiry.After(expiryTime) {
109
-		c.logger.Debug("Starting expiry timer with default duration")
109
+		c.logger.Debugf("Starting expiry timer with default duration")
110
 		c.expiryTimer.Reset(c.deletionTime + 1*time.Second)
110
 		c.expiryTimer.Reset(c.deletionTime + 1*time.Second)
111
 		c.nextExpiry = expiryTime
111
 		c.nextExpiry = expiryTime
112
 	}
112
 	}
118
 
118
 
119
 	for name, expiryTime := range c.expiryTimes {
119
 	for name, expiryTime := range c.expiryTimes {
120
 		if expiryTime.Before(now) {
120
 		if expiryTime.Before(now) {
121
-			c.logger.Info("Expiring %s", name)
121
+			c.logger.Infof("Expiring %s", name)
122
 			delete(c.expiryTimes, name)
122
 			delete(c.expiryTimes, name)
123
 			c.goneContainerNames <- name
123
 			c.goneContainerNames <- name
124
 		} else if next == 0 || expiryTime.Sub(now) < next {
124
 		} else if next == 0 || expiryTime.Sub(now) < next {

+ 1
- 1
dotege.go View File

60
 	}
60
 	}
61
 
61
 
62
 	certMonitor := certs.NewCertificateManager(sugar, certChan)
62
 	certMonitor := certs.NewCertificateManager(sugar, certChan)
63
-	certMonitor.AddDirectory("/data/certrequests/certs")
63
+	certMonitor.AddDirectory("/data/certrequests/certs/")
64
 	certDeployer := certs.NewCertificateDeployer(sugar, certChan)
64
 	certDeployer := certs.NewCertificateDeployer(sugar, certChan)
65
 
65
 
66
 	templateGenerator := NewTemplateGenerator(sugar)
66
 	templateGenerator := NewTemplateGenerator(sugar)

Loading…
Cancel
Save