Improve logging format and clarity for post/account insertion stats

This commit is contained in:
2025-05-14 14:56:18 +03:30
parent 8c7cfbd956
commit 02461d0bb0

View File

@@ -34,18 +34,14 @@ func main() {
var newAccounts = appContext.PostService.GetNewAccounts(existingAccountIds, newPosts)
// Save to database
log.Printf("Number of existing posts: %d, existing accounts: %d, new posts: %d, new accounts: %d\n", len(existingPostIds), len(existingAccountIds), len(newPosts), len(newAccounts))
log.Printf("Fetched %d posts, %d accounts; %d new posts and %d new accounts\n", len(posts), len(existingAccountIds), len(newPosts), len(newAccounts))
// Additional logging
if newAccounts != nil {
log.Println("Number of inserted accounts: ", appContext.PostService.InsertNewAccounts(newAccounts))
} else {
log.Print(" - No new accounts inserted")
log.Printf("Inserted %d accounts\n", appContext.PostService.InsertNewAccounts(newAccounts))
}
if newPosts != nil {
log.Print(" - Number of inserted posts: ", appContext.PostService.InsertNewPosts(newPosts))
} else {
log.Print(" - No new posts inserted")
log.Printf("Inserted %d posts\n", appContext.PostService.InsertNewPosts(newPosts))
}
}