rename some loggers to the same convention

This commit is contained in:
Roman Khafizianov 2023-03-07 10:42:36 +01:00 committed by Mikhail Iudin
parent 4d6e15e03b
commit da73ebf9ab
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
5 changed files with 17 additions and 13 deletions

View File

@ -57,10 +57,10 @@ func SetNamedLevels(l map[string]zap.AtomicLevel) {
logger, _ = loggerConfig.Build() logger, _ = loggerConfig.Build()
} }
for name, lg := range namedLoggers { for name, nl := range namedLoggers {
level := getLevel(name) level := getLevel(name)
// this can be racy, but // this can be racy, but
lg.Logger = zap.New(logger.Core()).WithOptions( nl.Logger = zap.New(logger.Core()).WithOptions(
zap.IncreaseLevel(level), zap.IncreaseLevel(level),
).Named(name) ).Named(name)
} }

View File

@ -3,6 +3,7 @@ package synctree
import ( import (
"context" "context"
"errors" "errors"
"github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/app/logger"
"github.com/anytypeio/any-sync/commonspace/object/acl/list" "github.com/anytypeio/any-sync/commonspace/object/acl/list"
"github.com/anytypeio/any-sync/commonspace/object/tree/objecttree" "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/object/tree/treestorage"
"github.com/anytypeio/any-sync/commonspace/objectsync" "github.com/anytypeio/any-sync/commonspace/objectsync"
"github.com/anytypeio/any-sync/commonspace/objectsync/synchandler" "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/commonspace/syncstatus"
"github.com/anytypeio/any-sync/net/peer" "github.com/anytypeio/any-sync/net/peer"
"github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/nodeconf"
@ -50,7 +51,7 @@ type syncTree struct {
isDeleted bool isDeleted bool
} }
var log = logger.NewNamed("commonspace.synctree") var log = logger.NewNamed("common.commonspace.synctree")
var buildObjectTree = objecttree.BuildObjectTree var buildObjectTree = objecttree.BuildObjectTree
var createSyncClient = newSyncClient var createSyncClient = newSyncClient

View File

@ -2,6 +2,9 @@ package objectsync
import ( import (
"context" "context"
"sync/atomic"
"time"
"github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/app/logger"
"github.com/anytypeio/any-sync/app/ocache" "github.com/anytypeio/any-sync/app/ocache"
"github.com/anytypeio/any-sync/commonspace/object/syncobjectgetter" "github.com/anytypeio/any-sync/commonspace/object/syncobjectgetter"
@ -12,11 +15,9 @@ import (
"github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/nodeconf"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
"sync/atomic"
"time"
) )
var log = logger.NewNamed("commonspace.objectsync") var log = logger.NewNamed("common.commonspace.objectsync")
type ObjectSync interface { type ObjectSync interface {
ocache.ObjectLastUsage ocache.ObjectLastUsage

View File

@ -5,6 +5,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/anytypeio/any-sync/accountservice" "github.com/anytypeio/any-sync/accountservice"
"github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/app/logger"
"github.com/anytypeio/any-sync/commonspace/object/keychain" "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/tree/treechangeproto"
"github.com/anytypeio/any-sync/commonspace/object/treegetter" "github.com/anytypeio/any-sync/commonspace/object/treegetter"
"github.com/anytypeio/any-sync/commonspace/settings/settingsstate" "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/commonspace/spacesyncproto"
"github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/nodeconf"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
@ -22,7 +23,7 @@ import (
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
) )
var log = logger.NewNamed("commonspace.settings") var log = logger.NewNamed("common.commonspace.settings")
type SettingsObject interface { type SettingsObject interface {
synctree.SyncTree synctree.SyncTree

View File

@ -3,15 +3,16 @@ package syncstatus
import ( import (
"context" "context"
"fmt" "fmt"
"sync"
"time"
"github.com/anytypeio/any-sync/app/logger" "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/commonspace/spacestorage"
"github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/nodeconf"
"github.com/anytypeio/any-sync/util/periodicsync" "github.com/anytypeio/any-sync/util/periodicsync"
"github.com/anytypeio/any-sync/util/slice" "github.com/anytypeio/any-sync/util/slice"
"golang.org/x/exp/slices" "golang.org/x/exp/slices"
"sync"
"time"
) )
const ( const (
@ -19,7 +20,7 @@ const (
syncTimeout = time.Second syncTimeout = time.Second
) )
var log = logger.NewNamed("commonspace.syncstatus") var log = logger.NewNamed("common.commonspace.syncstatus")
type UpdateReceiver interface { type UpdateReceiver interface {
UpdateTree(ctx context.Context, treeId string, status SyncStatus) (err error) UpdateTree(ctx context.Context, treeId string, status SyncStatus) (err error)