37 lines
999 B
Go
37 lines
999 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
func doPlayback() {
|
|
log.Infof("Found %d chat topic(s) in the log.", len(me.chats.GetChats()))
|
|
fmt.Println("-------------------------------------------------")
|
|
|
|
// Iterate through the top-level Chat messages, which are now named groups.
|
|
for _, chat := range me.chats.GetChats() {
|
|
|
|
// Get the number of entries in the chat.
|
|
entryCount := len(chat.GetEntries())
|
|
|
|
// Get the timestamp of the first entry to represent the chat's start time.
|
|
var formattedTime string
|
|
if entryCount > 0 && chat.GetEntries()[0].GetCtime() != nil {
|
|
t := chat.GetEntries()[0].GetCtime().AsTime()
|
|
formattedTime = t.Format("2006-01-02 15:04:05") // YYYY-MM-DD HH:MM:SS
|
|
} else {
|
|
formattedTime = "No Timestamp"
|
|
}
|
|
|
|
// Print the formatted one-line summary.
|
|
fmt.Printf("Topic: %-25s | Entries: %-4d | Started: %s\n",
|
|
chat.GetChatName(),
|
|
entryCount,
|
|
formattedTime,
|
|
)
|
|
}
|
|
fmt.Println("-------------------------------------------------")
|
|
}
|