Fix string formatting in logging statements using strconv.Itoa
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"CatsOfMastodonBotGo/internal/services"
|
||||
"context"
|
||||
"log/slog"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -40,14 +41,13 @@ func main() {
|
||||
var newAccounts = services.PostServiceInstance.GetNewAccounts(existingAccountIds, newPosts)
|
||||
|
||||
// Save to database
|
||||
slog.Info("Fetched %d posts; %d existing posts; %d new posts and %d new accounts\n", len(posts), len(existingPostIds), len(newPosts), len(newAccounts))
|
||||
|
||||
slog.Info("Fetched " + strconv.Itoa(len(posts)) + " posts; " + strconv.Itoa(len(existingPostIds)) + " existing posts; " + strconv.Itoa(len(newPosts)) + " new posts and " + strconv.Itoa(len(newAccounts)) + " new accounts\n")
|
||||
// Additional logging
|
||||
if newAccounts != nil {
|
||||
slog.Info("Inserted %d accounts\n", services.PostServiceInstance.InsertNewAccounts(newAccounts))
|
||||
slog.Info("Inserted " + strconv.Itoa(services.PostServiceInstance.InsertNewAccounts(newAccounts)) + " accounts\n")
|
||||
}
|
||||
if newPosts != nil {
|
||||
slog.Info("Inserted %d posts\n", services.PostServiceInstance.InsertNewPosts(newPosts))
|
||||
slog.Info("Inserted " + strconv.Itoa(services.PostServiceInstance.InsertNewPosts(newPosts)) + " posts\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user