aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/log.go
diff options
context:
space:
mode:
Diffstat (limited to 'cryptfs/log.go')
-rw-r--r--cryptfs/log.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cryptfs/log.go b/cryptfs/log.go
index 64dc80e..a7fe579 100644
--- a/cryptfs/log.go
+++ b/cryptfs/log.go
@@ -3,6 +3,7 @@ package cryptfs
import (
"fmt"
"strings"
+ "encoding/json"
)
type logChannel struct {
@@ -26,6 +27,18 @@ func (l *logChannel) Dump(d []byte) {
fmt.Println(strings.Replace(s, "\000", "\\0", -1))
}
+func (l *logChannel) JSONDump(obj interface{}) {
+ if !l.enabled {
+ return
+ }
+ b, err := json.MarshalIndent(obj, "", "\t")
+ if err != nil {
+ fmt.Println(err)
+ } else {
+ fmt.Println(string(b))
+ }
+}
+
func (l *logChannel) Enable() {
l.enabled = true
}