Add trace level to print out reponse thrift objects. Allows user to control wether these are printed or not to avoid pollution.
This commit is contained in:
parent
73e7ab2671
commit
24e63d6954
3 changed files with 26 additions and 6 deletions
|
@ -31,6 +31,7 @@ func (NoopLogger) Println(a ...interface{}) {}
|
|||
type LevelLogger struct {
|
||||
Logger
|
||||
debug bool
|
||||
trace bool
|
||||
}
|
||||
|
||||
func (l *LevelLogger) EnableDebug(enable bool) {
|
||||
|
@ -44,6 +45,13 @@ func (l LevelLogger) DebugPrintf(format string, a ...interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) TracePrintf(format string, a ...interface{}) {
|
||||
if l.debug {
|
||||
l.Print("[TRACE] ")
|
||||
l.Printf(format, a...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l LevelLogger) DebugPrint(a ...interface{}) {
|
||||
if l.debug {
|
||||
l.Print("[DEBUG] ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue