aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/log.go
blob: 32fe228328c82a455f8863e88a9433b67ed003cc (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
31
32
33
34
package cryptfs

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"os"
)

func JSONDump(obj interface{}) string {
	b, err := json.MarshalIndent(obj, "", "\t")
	if err != nil {
		return err.Error()
	} else {
		return string(b)
	}
}

// As defined by http://elinux.org/Debugging_by_printing#Log_Levels

// Debug messages
var Debug *log.Logger

// Informational message e.g. startup information
var Info *log.Logger

// A warning, meaning nothing serious by itself but might indicate problems
var Warn *log.Logger

func init() {
	Debug = log.New(ioutil.Discard, "", 0)
	Info = log.New(os.Stdout, "", 0)
	Warn = log.New(os.Stderr, "", 0)
}