summaryrefslogtreecommitdiff
path: root/cryptfs/log.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-03 13:36:49 +0200
committerJakob Unterwurzacher2015-10-03 19:16:34 +0200
commit79870ab0960febcbc82e32d632ed4a9ea99b6f03 (patch)
treee9af1bb576b40eef5214278e27bcb0fecb20aa3c /cryptfs/log.go
parent38bf8a2fcfe0b7260c08d49ed04c9667871f0992 (diff)
debug: log inode number instead of encrypted filename
Makes the log output smaller and more readable.
Diffstat (limited to 'cryptfs/log.go')
-rw-r--r--cryptfs/log.go14
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}