Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #605 from rbradford/log-depth-fix
Browse files Browse the repository at this point in the history
Fix logging wrappers to give correct source information
  • Loading branch information
mcastelino authored Sep 28, 2016
2 parents accc9b9 + 608f2b8 commit 2f601f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions ciao-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,27 @@ const (
)

func debugf(format string, args ...interface{}) {
glog.V(2).Infof("ciao-cli DEBUG: "+format, args...)
if glog.V(2) {
glog.InfoDepth(1, fmt.Sprintf("ciao-cli DEBUG: "+format, args...))
}
}

func infof(format string, args ...interface{}) {
glog.V(1).Infof("ciao-cli INFO: "+format, args...)
if glog.V(1) {
glog.InfoDepth(1, fmt.Sprintf("ciao-cli INFO: "+format, args...))
}
}

func warningf(format string, args ...interface{}) {
glog.Warningf("ciao-cli WARNING: "+format, args...)
glog.WarningDepth(1, fmt.Sprintf("ciao-cli WARNING: "+format, args...))
}

func errorf(format string, args ...interface{}) {
glog.Errorf("ciao-cli ERROR: "+format, args...)
glog.ErrorDepth(1, fmt.Sprintf("ciao-cli ERROR: "+format, args...))
}

func fatalf(format string, args ...interface{}) {
glog.Fatalf("ciao-cli FATAL: "+format, args...)
os.Exit(1)
glog.FatalDepth(1, fmt.Sprintf("ciao-cli FATAL: "+format, args...))
}

var (
Expand Down
6 changes: 3 additions & 3 deletions ssntp/ssntp.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,17 +886,17 @@ type glogLog struct{}

func (l glogLog) Infof(format string, args ...interface{}) {
if glog.V(2) {
glog.Infof("SSNTP Info: "+format, args...)
glog.InfoDepth(2, fmt.Sprintf("SSNTP Info: "+format, args...))
}
}

func (l glogLog) Errorf(format string, args ...interface{}) {
glog.Errorf("SSNTP Error: "+format, args...)
glog.ErrorDepth(2, fmt.Sprintf("SSNTP Error: "+format, args...))
}

func (l glogLog) Warningf(format string, args ...interface{}) {
if glog.V(1) {
glog.Warningf("SSNTP Warning: "+format, args...)
glog.WarningDepth(2, fmt.Sprintf("SSNTP Warning: "+format, args...))
}
}

Expand Down

0 comments on commit 2f601f6

Please sign in to comment.