summaryrefslogtreecommitdiff
path: root/doPlayback.go
diff options
context:
space:
mode:
Diffstat (limited to 'doPlayback.go')
-rw-r--r--doPlayback.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/doPlayback.go b/doPlayback.go
index 5e9ab0f..42dd95d 100644
--- a/doPlayback.go
+++ b/doPlayback.go
@@ -1,7 +1,6 @@
package main
import (
- "fmt"
"strings"
"go.wit.com/lib/protobuf/chatpb"
@@ -9,8 +8,8 @@ import (
)
func doPlayback() {
- if argv.Playback.Uuid != "" {
- showChat(argv.Playback.Uuid)
+ if argv.Uuid != "" {
+ showChat(argv.Uuid)
return
}
@@ -34,8 +33,8 @@ func listChats(chats *chatpb.Chats) {
return
}
- log.Infof("Found %d chat topic(s) in the log.", len(chats.GetChats()))
- fmt.Println("-------------------------------------------------")
+ log.Info("Found %d chat topic(s) in the log.", len(chats.GetChats()))
+ log.Println("-------------------------------------------------")
for _, chat := range chats.GetChats() {
entryCount := len(chat.GetEntries())
@@ -47,19 +46,19 @@ func listChats(chats *chatpb.Chats) {
formattedTime = "No Timestamp"
}
- fmt.Printf("Topic: %-25s | Entries: %-4d | Started: %s | UUID: %s\n",
+ log.Printf("Topic: %-25s | Entries: %-4d | Started: %s | UUID: %s\n",
chat.GetChatName(),
entryCount,
formattedTime,
chat.GetUuid(),
)
}
- fmt.Println("-------------------------------------------------")
+ log.Println("-------------------------------------------------")
}
// print out one line for each chat entry
func listEntries(chat *chatpb.Chat) {
- fmt.Printf("--- Entries for Topic: %s ---\n", chat.GetChatName())
+ log.Printf("--- Entries for Topic: %s ---\n", chat.GetChatName())
width := getTerminalWidth()
// Determine the maximum length of the author and time string
@@ -73,7 +72,7 @@ func listEntries(chat *chatpb.Chat) {
} else {
formattedTime = "No Time"
}
- authorAndTime := fmt.Sprintf("[%s] (%s)", author, formattedTime)
+ authorAndTime := log.Sprintf("[%s] (%s)", author, formattedTime)
if len(authorAndTime) > maxAuthorAndTimeLen {
maxAuthorAndTimeLen = len(authorAndTime)
}
@@ -94,7 +93,7 @@ func listEntries(chat *chatpb.Chat) {
// Replace newlines with spaces for a clean one-line view
contentPreview = strings.ReplaceAll(contentPreview, "\n", " ")
- authorAndTime := fmt.Sprintf("[%s] (%s)", author, formattedTime)
+ authorAndTime := log.Sprintf("[%s] (%s)", author, formattedTime)
availableWidth := width - maxAuthorAndTimeLen - 1 // -1 for a space
if len(contentPreview) > availableWidth {
@@ -112,14 +111,14 @@ func listEntries(chat *chatpb.Chat) {
if authorAndTimePadding < 0 {
authorAndTimePadding = 0
}
- fmt.Printf("%s%s%s%s\n", contentPreview, strings.Repeat(" ", padding), strings.Repeat(" ", authorAndTimePadding), authorAndTime)
+ log.Printf("%s%s%s%s\n", contentPreview, strings.Repeat(" ", padding), strings.Repeat(" ", authorAndTimePadding), authorAndTime)
} else {
padding := maxAuthorAndTimeLen - len(authorAndTime)
if padding < 0 {
padding = 0
}
- fmt.Printf("%s%s %s\n", authorAndTime, strings.Repeat(" ", padding), contentPreview)
+ log.Printf("%s%s %s\n", authorAndTime, strings.Repeat(" ", padding), contentPreview)
}
}
- fmt.Println("-------------------------------------------------")
+ log.Println("-------------------------------------------------")
}