new logging
This commit is contained in:
parent
8f9726c6e4
commit
76ef21fc66
16
Makefile
16
Makefile
|
@ -7,15 +7,15 @@ vet:
|
|||
@GO111MODULE=off go vet
|
||||
@echo this go binary package builds okay
|
||||
|
||||
verbose: goimports vet plugin
|
||||
verbose: goimports vet
|
||||
GO111MODULE=off go install -v -x \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
build: goimports vet plugin
|
||||
build: goimports vet
|
||||
GO111MODULE=off go build -v -x \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
install: goimports vet plugin
|
||||
install: goimports vet
|
||||
GO111MODULE=off go install \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
|
@ -23,14 +23,10 @@ gemini:
|
|||
GO111MODULE=off go install \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
install-raw: goimports vet plugin
|
||||
install-raw: goimports vet
|
||||
go install \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
plugin:
|
||||
rm -f resources/*.so
|
||||
# -cp ../../toolkits/gocui/gocui.so resources/
|
||||
|
||||
andlabs: clean install
|
||||
gemini --gui gocui --gui-verbose --gui-file ../../toolkits/andlabs/andlabs.so
|
||||
|
||||
|
@ -49,3 +45,7 @@ clean:
|
|||
|
||||
identify-protobuf:
|
||||
autogenpb --identify ~/.gemini/gemini.pb
|
||||
|
||||
|
||||
playback:
|
||||
gemini playback
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"go.wit.com/lib/protobuf/chatpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
@ -12,10 +13,24 @@ func doPlayback() {
|
|||
return
|
||||
}
|
||||
|
||||
log.Infof("Found %d chat topic(s) in the log.", len(me.chats.GetChats()))
|
||||
listChats(me.chats)
|
||||
}
|
||||
|
||||
func showChat(uuid string) {
|
||||
chat := me.chats.FindByUuid(uuid)
|
||||
if chat == nil {
|
||||
log.Info("unknown uuid", uuid)
|
||||
return
|
||||
}
|
||||
// Call the new, dedicated formatting function.
|
||||
prettyFormatChat(chat)
|
||||
}
|
||||
|
||||
func listChats(chats *chatpb.Chats) {
|
||||
log.Infof("Found %d chat topic(s) in the log.", len(chats.GetChats()))
|
||||
fmt.Println("-------------------------------------------------")
|
||||
|
||||
for _, chat := range me.chats.GetChats() {
|
||||
for _, chat := range chats.GetChats() {
|
||||
entryCount := len(chat.GetEntries())
|
||||
var formattedTime string
|
||||
if ctime := chat.GetCtime(); ctime != nil {
|
||||
|
@ -34,13 +49,3 @@ func doPlayback() {
|
|||
}
|
||||
fmt.Println("-------------------------------------------------")
|
||||
}
|
||||
|
||||
func showChat(uuid string) {
|
||||
chat := me.chats.FindByUuid(uuid)
|
||||
if chat == nil {
|
||||
log.Info("unknown uuid", uuid)
|
||||
return
|
||||
}
|
||||
// Call the new, dedicated formatting function.
|
||||
prettyFormatChat(chat)
|
||||
}
|
||||
|
|
9
main.go
9
main.go
|
@ -58,15 +58,14 @@ func main() {
|
|||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
verifyUuids(newChats)
|
||||
listChats(newChats)
|
||||
for _, newChat := range newChats.GetChats() {
|
||||
me.chats.AppendByUuid(newChat)
|
||||
}
|
||||
listChats(me.chats)
|
||||
|
||||
// The verifyUuids function should be run on the main chats object
|
||||
// after adding the new chats.
|
||||
if verifyUuids(me.chats) {
|
||||
me.chats.ConfigSave()
|
||||
}
|
||||
me.chats.ConfigSave()
|
||||
okExit("")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue