yats.git

commit 6da05809d41b4d336c9da0f6b68c4ca41c7810b3

Author: Paolo Lulli <paolo@lulli.net>

Debug

 server/config/config.go | 2 ++
 server/rest/rest-metric.go | 8 +++++++-


diff --git a/server/config/config.go b/server/config/config.go
index 7e276b83e953a62216c91c25dc00e9f343111cfb..12227ed78f203eb48af06d6d78d1a2f97ec7321f 100644
--- a/server/config/config.go
+++ b/server/config/config.go
@@ -52,6 +52,8 @@
 	TlsActive      string `json:"tlsActive"`
 	TlsKeyFile     string `json:"tlsKeyFile"`
 	TlsCertificate string `json:"tlsCertificate"`
+
+	LogFile string `json:"logFile"`
 }
 
 func GetConfig(fileName string) Configuration {




diff --git a/server/rest/rest-metric.go b/server/rest/rest-metric.go
index 02ceb3d212d23e75cf3253798bd3576dd41780c6..7c18fcb2fff8c459809b4adeb81cef626021abce 100644
--- a/server/rest/rest-metric.go
+++ b/server/rest/rest-metric.go
@@ -15,11 +15,17 @@ 	"fmt"
 	"github.com/gin-gonic/gin"
 	"log"
 	"net/http"
+	"os"
 	"strconv"
 	"time"
 	"yats-server/config"
 	"yats-server/db"
 	"yats-server/model"
+)
+
+var (
+	//outfile, _ = os.Create(configuration.LogFile)
+	LOG = log.New(os.Stdout, "[YATS] ", log.Ldate|log.Ltime)
 )
 
 // @BasePath /
@@ -102,7 +108,7 @@ 			toUnixTimeUTC := time.Unix(metric.To, 0)
 			fromInBytes, _ := fromUnixTimeUTC.UTC().MarshalText()
 			toInBytes, _ := toUnixTimeUTC.UTC().MarshalText()
 			fmt.Printf("PASSING HERE, from %s to %s \n", fromInBytes, toInBytes)
-			log.Printf("PASSING HERE, from %s to %s\n", fromInBytes, toInBytes)
+			LOG.Printf("PASSING HERE, from %s to %s\n", fromInBytes, toInBytes)
 			metricsPack = db.MetricsBetween(db.Session, clientCN, metric.Name, string(fromInBytes), string(toInBytes), 100)
 		}
 		c.IndentedJSON(http.StatusAccepted, gin.H{"ret": "OK", "data": metricsPack})