Skip to content

Commit

Permalink
refactor(bitswap): unify logger names (#637)
Browse files Browse the repository at this point in the history
* Unify bitswap logger names

Use uniform pattern for logger naming: bitswap/pkgname

Slash delimiters are used to separate path segments used in logger names. This follows the conventios used most commonly in other parts of boxo.

* Update CHANGELOG
  • Loading branch information
gammazero authored Jul 9, 2024
1 parent 0d38f3a commit 2816b71
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The following emojis are used to highlight certain changes:
### Changed

- `bitswap/server` minor memory use and performance improvements
- `bitswap` unify logger names to use uniform format bitswap/path/pkgname

### Removed

Expand Down
2 changes: 1 addition & 1 deletion bitswap/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"go.opentelemetry.io/otel/trace"
)

var log = logging.Logger("bitswap-client")
var log = logging.Logger("bitswap/client")

// Option defines the functional option type that can be used to configure
// bitswap instances
Expand Down
2 changes: 1 addition & 1 deletion bitswap/client/internal/getter/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
ipld "github.com/ipfs/go-ipld-format"
)

var log = logging.Logger("bitswap")
var log = logging.Logger("bitswap/client/getter")

// GetBlocksFunc is any function that can take an array of CIDs and return a
// channel of incoming blocks.
Expand Down
2 changes: 1 addition & 1 deletion bitswap/client/internal/messagequeue/messagequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

var (
log = logging.Logger("bitswap")
log = logging.Logger("bitswap/client/msgq")
sflog = log.Desugar()
)

Expand Down
2 changes: 1 addition & 1 deletion bitswap/client/internal/peermanager/peermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
peer "github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bs:peermgr")
var log = logging.Logger("bitswap/client/peermgr")

// PeerQueue provides a queue of messages to be sent for a single peer.
type PeerQueue interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"go.opentelemetry.io/otel/trace"
)

var log = logging.Logger("bitswap")
var log = logging.Logger("bitswap/client/provqrymgr")

const (
maxProviders = 10
Expand Down
2 changes: 1 addition & 1 deletion bitswap/client/internal/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

var (
log = logging.Logger("bs:sess")
log = logging.Logger("bitswap/session")
sflog = log.Desugar()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
peer "github.com/libp2p/go-libp2p/core/peer"
)

var log = logging.Logger("bs:sprmgr")
var log = logging.Logger("bitswap/client/sesspeermgr")

const (
// Connection Manager tag value for session peers. Indicates to connection
Expand Down
2 changes: 1 addition & 1 deletion bitswap/network/ipfs_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/multiformats/go-multistream"
)

var log = logging.Logger("bitswap_network")
var log = logging.Logger("bitswap/network")

var connectTimeout = time.Second * 5

Expand Down
2 changes: 1 addition & 1 deletion bitswap/server/internal/decision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import (
// whatever it sees fit to produce desired outcomes (get wanted keys
// quickly, maintain good relationships with peers, etc).

var log = logging.Logger("engine")
var log = logging.Logger("bitswap/server/decision")

const (
// outboxChanBuffer must be 0 to prevent stale messages from being sent
Expand Down
2 changes: 1 addition & 1 deletion bitswap/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
var provideKeysBufferSize = 2048

var (
log = logging.Logger("bitswap-server")
log = logging.Logger("bitswap/server")
sflog = log.Desugar()
)

Expand Down

0 comments on commit 2816b71

Please sign in to comment.