Add the ability to turn on/off debug logging
This commit is contained in:
parent
4ff30ee723
commit
2d93acf065
|
@ -33,8 +33,14 @@ type Ricochet struct {
|
||||||
// Init sets up the Ricochet object. It takes in a filename of a hidden service
|
// Init sets up the Ricochet object. It takes in a filename of a hidden service
|
||||||
// private_key file so it can successfully authenticate itself with other
|
// private_key file so it can successfully authenticate itself with other
|
||||||
// clients.
|
// clients.
|
||||||
func (r *Ricochet) Init(filename string) {
|
func (r *Ricochet) Init(filename string, debugLog bool) {
|
||||||
|
|
||||||
|
if debugLog {
|
||||||
r.logger = log.New(os.Stdout, "[Ricochet]: ", log.Ltime|log.Lmicroseconds)
|
r.logger = log.New(os.Stdout, "[Ricochet]: ", log.Ltime|log.Lmicroseconds)
|
||||||
|
} else {
|
||||||
|
r.logger = log.New(ioutil.Discard, "[Ricochet]: ", log.Ltime|log.Lmicroseconds)
|
||||||
|
}
|
||||||
|
|
||||||
pemData, err := ioutil.ReadFile(filename)
|
pemData, err := ioutil.ReadFile(filename)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue