LogMutex sync.Mutex
KeyEraseLine string
- LogWasStatus bool
)
func init() {
}
func erasedStatus(s, end string) string {
- if LogWasStatus {
- s += KeyEraseLine
+ if NoProgress {
+ return s + end
}
- return s + end
+ return s + KeyEraseLine + end
}
func trace(level, format string, args ...interface{}) {
}
switch level {
case CNone:
- p = StderrPrefix + p + fmt.Sprintf(format, args...)
+ p = erasedStatus(StderrPrefix+p+fmt.Sprintf(format, args...), "\n")
LogMutex.Lock()
- os.Stderr.WriteString(erasedStatus(p, "\n"))
- LogWasStatus = false
+ os.Stderr.WriteString(p)
LogMutex.Unlock()
return
case CDebug:
}
msg := fmt.Sprintf(format, args...)
msg = StderrPrefix + colourize(level, p+strings.Repeat(". ", Level)+msg)
+ msg = erasedStatus(msg, "\n")
LogMutex.Lock()
- os.Stderr.WriteString(erasedStatus(msg, "\n"))
- LogWasStatus = false
+ os.Stderr.WriteString(msg)
LogMutex.Unlock()
}