diff options
Diffstat (limited to 'cryptfs/log.go')
-rw-r--r-- | cryptfs/log.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cryptfs/log.go b/cryptfs/log.go index d40aa3f..850ec9e 100644 --- a/cryptfs/log.go +++ b/cryptfs/log.go @@ -15,6 +15,12 @@ func (l *logChannel) Printf(format string, args ...interface{}) { } } +func (l *logChannel) Println(s string) { + if l.enabled == true { + fmt.Println(s) + } +} + func (l *logChannel) Dump(d []byte) { s := string(d) fmt.Println(strings.Replace(s, "\000", "\\0", -1)) @@ -24,6 +30,14 @@ func (l *logChannel) Enable() { l.enabled = true } +// Only actually calculate the md5sum if the log channel is enabled to save +// CPU cycles +func (l *logChannel) Md5sum(buf []byte) string { + if l.enabled == false { + return "" + } + return md5sum(buf) +} var Debug = logChannel{false} var Notice = logChannel{true} |