diff --git a/go/characters/postmanpat.go b/go/characters/postmanpat.go index c149abdf..18dae10a 100644 --- a/go/characters/postmanpat.go +++ b/go/characters/postmanpat.go @@ -4,7 +4,7 @@ import ( "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/the" "git.openprivacy.ca/openprivacy/libricochet-go/channels" - "log" + "git.openprivacy.ca/openprivacy/libricochet-go/log" ) func PostmanPat(messages chan gobjects.Letter) { @@ -31,7 +31,7 @@ func andHisBlackAndWhiteCat(incomingMessages chan gobjects.Letter) { connection.DoOnChannel("im.ricochet.chat", channels.Outbound, func(channel *channels.Channel) { chatchannel, ok := channel.Handler.(*channels.ChatChannel) if ok { - log.Printf("Sending packet") + log.Debugln("Sending packet") the.AcknowledgementIDs[chatchannel.SendMessage(m.Message)] = m.MID } }) diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index ae9b5739..edc32147 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -11,7 +11,7 @@ import ( "encoding/base32" "fmt" "github.com/therecipe/qt/core" - "log" + "git.openprivacy.ca/openprivacy/libricochet-go/log" "strings" "time" ) @@ -110,9 +110,9 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { this.UIState.UpdateContact(handle) if len(handle) == 32 { // LOAD GROUP - log.Printf("LOADING GROUP %s", handle) + log.Debugf("LOADING GROUP %s", handle) tl := the.Peer.GetGroup(handle).GetTimeline() - log.Printf("messages: %d", len(tl)) + log.Debugf("messages: %d", len(tl)) for i := range tl { if tl[i].PeerID == the.Peer.GetProfile().Onion { handle = "me" @@ -159,7 +159,7 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) { } func (this *GrandCentralDispatcher) requestGroupSettings() { - log.Printf("requestGroupSettings()") + log.Debugf("requestGroupSettings()") group := the.Peer.GetGroup(this.CurrentOpenConversation()) nick, _ := group.GetAttribute("nick") invite, _ := the.Peer.ExportGroup(this.CurrentOpenConversation()) @@ -169,7 +169,7 @@ func (this *GrandCentralDispatcher) requestGroupSettings() { func (this *GrandCentralDispatcher) broadcast(signal string) { switch signal { default: - log.Printf("unhandled broadcast signal: %v", signal) + log.Debugf("unhandled broadcast signal: %v", signal) case "ResetMessagePane": this.ResetMessagePane() } @@ -177,11 +177,11 @@ func (this *GrandCentralDispatcher) broadcast(signal string) { func (this *GrandCentralDispatcher) importString(str string) { if len(str) < 5 { - log.Printf("ignoring short string") + log.Debugf("ignoring short string") return } - log.Printf("importing: %s\n", str) + log.Debugf("importing: %s\n", str) onion := str name := onion str = strings.TrimSpace(str) @@ -239,7 +239,7 @@ func (this *GrandCentralDispatcher) importString(str string) { _, err := base32.StdEncoding.DecodeString(strings.ToUpper(onion[:56])) if err != nil { - log.Printf("%v", err) + log.Debugln(err) this.InvokePopup("bad format. missing characters?") return } diff --git a/go/gothings/uistate.go b/go/gothings/uistate.go index 13931747..d280bcc9 100644 --- a/go/gothings/uistate.go +++ b/go/gothings/uistate.go @@ -6,7 +6,7 @@ import ( "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/the" "encoding/base32" - "log" + "git.openprivacy.ca/openprivacy/libricochet-go/log" "strings" ) @@ -32,7 +32,7 @@ func (this *InterfaceState) AddContact(c *gobjects.Contact) { return } else if len(c.Handle) != 56 { - log.Printf("sorry, unable to handle AddContact(%v)", c.Handle) + log.Errorf("sorry, unable to handle AddContact(%v)", c.Handle) return } diff --git a/main.go b/main.go index c5652195..98d6b54b 100644 --- a/main.go +++ b/main.go @@ -13,11 +13,11 @@ import ( "git.openprivacy.ca/openprivacy/libricochet-go/application" "git.openprivacy.ca/openprivacy/libricochet-go/channels" "git.openprivacy.ca/openprivacy/libricochet-go/connectivity" + "git.openprivacy.ca/openprivacy/libricochet-go/log" "github.com/therecipe/qt/core" "github.com/therecipe/qt/quick" "github.com/therecipe/qt/quickcontrols2" "github.com/therecipe/qt/widgets" - "log" "os" "os/user" "path" @@ -98,7 +98,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { /*_, err := app2.NewApp(dirname, "/data/data/org.qtproject.example.go/lib/libtor.so") if err != nil { - log.Printf("ERROR CREATING CWTCH APP: %v", err) + log.Errorf("ERROR CREATING CWTCH APP: %v", err) } time.Sleep(time.Second * 10) */ @@ -106,7 +106,8 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { mn, err := connectivity.StartTor(the.CwtchDir, "") if err != nil { - log.Printf("[!!!] Could not start Tor: %v", err) + log.Errorf("Could not start Tor: %v", err) + os.Exit(1) } the.CwtchApp = libapp.NewApp(mn, the.CwtchDir) @@ -114,14 +115,16 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { err = the.CwtchApp.LoadProfiles("be gay do crime") if err != nil { //TODO no more fatalfs - log.Fatalf("couldn't load profiles: %v", err) + log.Errorf("couldn't load profiles: %v", err) + os.Exit(1) } if len(the.CwtchApp.ListPeers()) == 0 { - log.Printf("couldn't load your config file. attempting to create one now") + log.Infoln("couldn't load your config file. attempting to create one now") the.Peer, err = the.CwtchApp.CreatePeer("alice", "be gay do crime") if err != nil { - log.Fatalf("couldn't create one. is your cwtch folder writable?") + log.Errorf("couldn't create one. is your cwtch folder writable?") + os.Exit(1) } the.CwtchApp.SaveProfile(the.Peer) } else { @@ -162,7 +165,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { groups := the.Peer.GetGroups() for i := range groups { - log.Printf("adding saved group %v", groups[i]) + log.Infof("adding saved group %v", groups[i]) group := the.Peer.GetGroup(groups[i]) group.NewMessage = make(chan model.Message) go characters.CwtchListener(gcd.UIState.AddMessage, groups[i], group.NewMessage)