rename some loggers to the same convention

This commit is contained in:
Roman Khafizianov 2023-03-07 10:42:36 +01:00
parent 3693218fc5
commit 0d40838196
No known key found for this signature in database
GPG Key ID: F07A7D55A2684852
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()
}
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)
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)