summaryrefslogtreecommitdiff
path: root/cryptfs/log.go
blob: d40aa3ff2f9987212e817cabbadd47a577a07621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package cryptfs

import (
	"fmt"
	"strings"
)

type logChannel struct {
	enabled bool
}

func (l *logChannel) Printf(format string, args ...interface{}) {
	if l.enabled == true {
		fmt.Printf(format, args...)
	}
}

func (l *logChannel) Dump(d []byte) {
	s := string(d)
	fmt.Println(strings.Replace(s, "\000", "\\0", -1))
}

func (l *logChannel) Enable() {
	l.enabled = true
}


var Debug = logChannel{false}
var Notice = logChannel{true}
var Warn = logChannel{true}