From 2d93acf065a0ccc9874c1a62604dd51ffa87a6a7 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 15 Oct 2015 23:27:16 -0700 Subject: [PATCH] Add the ability to turn on/off debug logging --- ricochet.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ricochet.go b/ricochet.go index f15ac57..ec0dcdb 100644 --- a/ricochet.go +++ b/ricochet.go @@ -33,8 +33,14 @@ type Ricochet struct { // 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 // clients. -func (r *Ricochet) Init(filename string) { - r.logger = log.New(os.Stdout, "[Ricochet]: ", log.Ltime|log.Lmicroseconds) +func (r *Ricochet) Init(filename string, debugLog bool) { + + if debugLog { + 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) if err != nil {