Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add log prefix

Neeraj Guptacab929da2b39
diff --git a/pkg/remote_sync.go b/pkg/remote_sync.go
index 45e1598d20..c3e0831cbf 100644
--- a/pkg/remote_sync.go
+++ b/pkg/remote_sync.go
@@ -10,7 +10,6 @@ import (
)
func (c *ClICtrl) SyncAccount(account model.Account) error {
- log.SetPrefix(fmt.Sprintf("[%s] ", account.Email))
secretInfo, err := c.KeyHolder.LoadSecrets(account, c.CliKey)
if err != nil {
return err
@@ -21,7 +20,11 @@ func (c *ClICtrl) SyncAccount(account model.Account) error {
return err
}
c.Client.AddToken(account.AccountKey(), base64.URLEncoding.EncodeToString(secretInfo.Token))
- return c.fetchRemoteCollections(ctx, account)
+ err = c.fetchRemoteCollections(ctx, account)
+ if err != nil {
+ log.Printf("Error fetching collections: %s", err)
+ }
+ return nil
}
func (c *ClICtrl) buildRequestContext(ctx context.Context, account model.Account) context.Context {
diff --git a/pkg/sync.go b/pkg/sync.go
index 3476d2e8e0..194515bbf7 100644
--- a/pkg/sync.go
+++ b/pkg/sync.go
@@ -3,6 +3,7 @@ package pkg
import (
"context"
"fmt"
+ "log"
)
func (c *ClICtrl) StartSync() error {
@@ -15,12 +16,16 @@ func (c *ClICtrl) StartSync() error {
return nil
}
for _, account := range accounts {
- fmt.Printf("Syncing account %s\n", account.Email)
+ log.SetPrefix(fmt.Sprintf("[%s-%s] ", account.App, account.Email))
+ log.Println("start sync")
err = c.SyncAccount(account)
if err != nil {
fmt.Printf("Error syncing account %s: %s\n", account.Email, err)
return err
+ } else {
+ log.Println("sync done")
}
+
}
return nil
}