File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed
Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1+
2+ package common
3+
4+ import "github.com/golang/glog"
5+
6+ // Log verbosity levels for use with glog.V()
7+ const (
8+ LogLevelInfo glog.Level = 1
9+ LogLevelDebug glog.Level = 2
10+ LogLevelTrace glog.Level = 3
11+ )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414 "time"
1515
1616 "github.com/golang/glog"
17+ "github.com/salesforce/sloop/pkg/sloop/common"
1718)
1819
1920// Example Event
@@ -91,14 +92,14 @@ func ExtractEventInfo(payload string) (*EventInfo, error) {
9192
9293 fs , err := time .Parse (time .RFC3339 , internalResource .FirstTimestamp )
9394 if err != nil {
94- glog .Errorf ( "Could not parse first timestamp %v\n " , internalResource .FirstTimestamp )
95+ glog .V ( common . LogLevelDebug ). Infof ( "Could not parse first timestamp %v" , internalResource .FirstTimestamp )
9596 fs = time.Time {}
9697 }
9798
9899 ls , err := time .Parse (time .RFC3339 , internalResource .LastTimestamp )
99100 if err != nil {
100- glog .Errorf ( "Could not parse last timestamp %v\n " , internalResource .LastTimestamp )
101- fs = time.Time {}
101+ glog .V ( common . LogLevelDebug ). Infof ( "Could not parse last timestamp %v" , internalResource .LastTimestamp )
102+ ls = time.Time {}
102103 }
103104
104105 return & EventInfo {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020 "github.com/golang/glog"
2121 "github.com/pkg/errors"
2222
23+ "github.com/salesforce/sloop/pkg/sloop/common"
2324 "github.com/salesforce/sloop/pkg/sloop/server/server_metrics"
2425 "github.com/salesforce/sloop/pkg/sloop/webserver"
2526)
@@ -257,17 +258,17 @@ func loadFromFile(filename string, config *SloopConfig) *SloopConfig {
257258func getConfigFilePath () string {
258259 configFileFlag := getConfigFlag ()
259260 if configFileFlag != "" {
260- glog .Infof ("Config flag: %s" , configFileFlag )
261+ glog .V ( common . LogLevelDebug ). Infof ("Config flag: %s" , configFileFlag )
261262 return configFileFlag
262263 }
263264
264265 configFileOS := os .Getenv (sloopConfigEnvVar )
265266 if configFileOS != "" {
266- glog .Infof ("Config env: %s" , configFileOS )
267+ glog .V ( common . LogLevelDebug ). Infof ("Config env: %s" , configFileOS )
267268 return configFileOS
268269 }
269270
270- glog .Infof ("Default config set" )
271+ glog .V ( common . LogLevelDebug ). Info ("Default config set" )
271272 return ""
272273}
273274
You can’t perform that action at this time.
0 commit comments