diff --git a/app/logger/log.go b/app/logger/log.go index ce09c3cd..264cdaf1 100644 --- a/app/logger/log.go +++ b/app/logger/log.go @@ -57,10 +57,10 @@ func SetNamedLevels(l map[string]zap.AtomicLevel) { logger, _ = loggerConfig.Build() } - for name, lg := range namedLoggers { + for name, nl := range namedLoggers { level := getLevel(name) // this can be racy, but - lg.Logger = zap.New(logger.Core()).WithOptions( + nl.Logger = zap.New(logger.Core()).WithOptions( zap.IncreaseLevel(level), ).Named(name) } diff --git a/commonspace/object/tree/synctree/synctree.go b/commonspace/object/tree/synctree/synctree.go index d9084017..f25e14d0 100644 --- a/commonspace/object/tree/synctree/synctree.go +++ b/commonspace/object/tree/synctree/synctree.go @@ -3,6 +3,7 @@ package synctree import ( "context" "errors" + "github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/commonspace/object/acl/list" "github.com/anytypeio/any-sync/commonspace/object/tree/objecttree" @@ -10,7 +11,7 @@ import ( "github.com/anytypeio/any-sync/commonspace/object/tree/treestorage" "github.com/anytypeio/any-sync/commonspace/objectsync" "github.com/anytypeio/any-sync/commonspace/objectsync/synchandler" - spacestorage "github.com/anytypeio/any-sync/commonspace/spacestorage" + "github.com/anytypeio/any-sync/commonspace/spacestorage" "github.com/anytypeio/any-sync/commonspace/syncstatus" "github.com/anytypeio/any-sync/net/peer" "github.com/anytypeio/any-sync/nodeconf" @@ -50,7 +51,7 @@ type syncTree struct { isDeleted bool } -var log = logger.NewNamed("commonspace.synctree") +var log = logger.NewNamed("common.commonspace.synctree") var buildObjectTree = objecttree.BuildObjectTree var createSyncClient = newSyncClient diff --git a/commonspace/objectsync/objectsync.go b/commonspace/objectsync/objectsync.go index 7c72e635..85c587d9 100644 --- a/commonspace/objectsync/objectsync.go +++ b/commonspace/objectsync/objectsync.go @@ -2,6 +2,9 @@ package objectsync import ( "context" + "sync/atomic" + "time" + "github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/app/ocache" "github.com/anytypeio/any-sync/commonspace/object/syncobjectgetter" @@ -12,11 +15,9 @@ import ( "github.com/anytypeio/any-sync/nodeconf" "go.uber.org/zap" "golang.org/x/exp/slices" - "sync/atomic" - "time" ) -var log = logger.NewNamed("commonspace.objectsync") +var log = logger.NewNamed("common.commonspace.objectsync") type ObjectSync interface { ocache.ObjectLastUsage diff --git a/commonspace/settings/settings.go b/commonspace/settings/settings.go index 1b75e42d..453df055 100644 --- a/commonspace/settings/settings.go +++ b/commonspace/settings/settings.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "github.com/anytypeio/any-sync/accountservice" "github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/commonspace/object/keychain" @@ -14,7 +15,7 @@ import ( "github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto" "github.com/anytypeio/any-sync/commonspace/object/treegetter" "github.com/anytypeio/any-sync/commonspace/settings/settingsstate" - spacestorage "github.com/anytypeio/any-sync/commonspace/spacestorage" + "github.com/anytypeio/any-sync/commonspace/spacestorage" "github.com/anytypeio/any-sync/commonspace/spacesyncproto" "github.com/anytypeio/any-sync/nodeconf" "github.com/gogo/protobuf/proto" @@ -22,7 +23,7 @@ import ( "golang.org/x/exp/slices" ) -var log = logger.NewNamed("commonspace.settings") +var log = logger.NewNamed("common.commonspace.settings") type SettingsObject interface { synctree.SyncTree diff --git a/commonspace/syncstatus/syncstatus.go b/commonspace/syncstatus/syncstatus.go index b5a489a5..091988f5 100644 --- a/commonspace/syncstatus/syncstatus.go +++ b/commonspace/syncstatus/syncstatus.go @@ -3,15 +3,16 @@ package syncstatus import ( "context" "fmt" + "sync" + "time" + "github.com/anytypeio/any-sync/app/logger" - treestorage "github.com/anytypeio/any-sync/commonspace/object/tree/treestorage" + "github.com/anytypeio/any-sync/commonspace/object/tree/treestorage" "github.com/anytypeio/any-sync/commonspace/spacestorage" "github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/util/periodicsync" "github.com/anytypeio/any-sync/util/slice" "golang.org/x/exp/slices" - "sync" - "time" ) const ( @@ -19,7 +20,7 @@ const ( syncTimeout = time.Second ) -var log = logger.NewNamed("commonspace.syncstatus") +var log = logger.NewNamed("common.commonspace.syncstatus") type UpdateReceiver interface { UpdateTree(ctx context.Context, treeId string, status SyncStatus) (err error)