Skip to content

Commit

Permalink
Merge pull request #11 from lpabon/removedebug
Browse files Browse the repository at this point in the history
Remove filename in debug
  • Loading branch information
lpabon committed Mar 17, 2017
2 parents fcb3f13 + fe686ab commit 435bc5b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions log.go
Expand Up @@ -57,13 +57,6 @@ func logWithLongFile(l *log.Logger, format string, v ...interface{}) {
fmt.Sprintf(format, v...))
}

func logWithLongFileAndFunction(l *log.Logger, format string, v ...interface{}) {
pc, file, line, _ := runtime.Caller(2)
caller_func_info := runtime.FuncForPC(pc)
l.Print(fmt.Sprintf("%v:%v(%v): ", path.Base(file), line, path.Base(caller_func_info.Name())) +
fmt.Sprintf(format, v...))
}

// Create a new logger
func NewLogger(prefix string, level LogLevel) *Logger {
godbc.Require(level >= 0, level)
Expand Down Expand Up @@ -157,6 +150,6 @@ func (l *Logger) Info(format string, v ...interface{}) {
// Log string as debug
func (l *Logger) Debug(format string, v ...interface{}) {
if l.level >= LEVEL_DEBUG {
logWithLongFileAndFunction(l.debuglog, format, v...)
logWithLongFile(l.debuglog, format, v...)
}
}

0 comments on commit 435bc5b

Please sign in to comment.