new logging

This commit is contained in:
Jeff Carr 2025-08-22 04:00:41 -05:00
parent 8f9726c6e4
commit 76ef21fc66
3 changed files with 29 additions and 25 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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("")
}