From e20784a0d5a26dad63328bfc55a50985b3082336 Mon Sep 17 00:00:00 2001
From: Miki <mikif70@gmail.com>
Date: Thu, 12 Nov 2015 09:33:06 +0100
Subject: [PATCH] aggiunto il numero di user consolidati e il totale user da
 consolidare al file di log

---
 lastlogin_consolidate.go | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lastlogin_consolidate.go b/lastlogin_consolidate.go
index 2c41fe6..05a7607 100644
--- a/lastlogin_consolidate.go
+++ b/lastlogin_consolidate.go
@@ -14,7 +14,7 @@ import (
 )
 
 const (
-	_VERSION = "v1.0.7"
+	_VERSION = "v1.0.8"
 	_tformat = "2006-01-02"
 	_24h     = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)
 	_10m     = (time.Minute * 10)
@@ -186,6 +186,9 @@ func main() {
 		fmt.Printf("Start: %+v, Stop: %+v\n\r", ys, ye)
 	}
 
+	countTOT := 0
+	countOK := 0
+
 	for i := range ys {
 
 		pStart := time.Now()
@@ -204,13 +207,14 @@ func main() {
 		q.Distinct("user", &ar)
 
 		if opts.Debug {
-			fmt.Printf("Distinct: %s\n\r", time.Since(qStart))
+			fmt.Printf("Distinct user: %s\n\r", time.Since(qStart))
 		}
 
 		fmt.Printf("Date: %s - %s\n", ys[i], ye[i])
 		log.Printf("Date: %s - %s\n", ys[i], ye[i])
 
 		for u := range ar {
+			countTOT += 1
 			ll := LastLoginDay{}
 			ll.User = ar[u]
 			ll.Date = ys[i]
@@ -253,10 +257,12 @@ func main() {
 			if err != nil {
 				log.Println("Insert error: ", err)
 			}
+			countOK += 1
 		}
 		fmt.Printf("Stop %s: %s\n", ys[i], time.Since(pStart))
+		log.Printf("Stop %s: %s\n", ys[i], time.Since(pStart))
 	}
 
-	fmt.Println("Stop: ", time.Since(start))
-	log.Println("Stop: ", time.Since(start))
+	fmt.Printf("Stop: OK: %i - TOT: %i - Time: %s\n\r", countOK, countTOT, time.Since(start))
+	log.Printf("Stop: OK: %i - TOT: %i - Time: %s\n\r", countOK, countTOT, time.Since(start))
 }