Skip to content

Commit

Permalink
fix: add logger field (#234)
Browse files Browse the repository at this point in the history
This will be ignored by pre v1 versions
  • Loading branch information
achingbrain authored Nov 10, 2023
1 parent 906b0d1 commit 6f4728c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions packages/libp2p-daemon-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StreamHandler } from '@libp2p/daemon-protocol/stream-handler'
import { passThroughUpgrader } from '@libp2p/daemon-protocol/upgrader'
import { CodeError } from '@libp2p/interface/errors'
import { isPeerId, type PeerId } from '@libp2p/interface/peer-id'
import { logger } from '@libp2p/logger'
import { defaultLogger, logger } from '@libp2p/logger'
import { peerIdFromBytes } from '@libp2p/peer-id'
import { tcp } from '@libp2p/tcp'
import { multiaddr, isMultiaddr } from '@multiformats/multiaddr'
Expand All @@ -27,7 +27,10 @@ class Client implements DaemonClient {

constructor (addr: Multiaddr) {
this.multiaddr = addr
this.tcp = tcp()()
this.tcp = tcp()({
// @ts-expect-error this field will be present post v1
logger: defaultLogger()
})
this.dht = new DHT(this)
this.pubsub = new Pubsub(this)
}
Expand Down
7 changes: 5 additions & 2 deletions packages/libp2p-daemon-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@libp2p/daemon-protocol'
import { StreamHandler } from '@libp2p/daemon-protocol/stream-handler'
import { passThroughUpgrader } from '@libp2p/daemon-protocol/upgrader'
import { logger } from '@libp2p/logger'
import { defaultLogger, logger } from '@libp2p/logger'
import { peerIdFromBytes } from '@libp2p/peer-id'
import { tcp } from '@libp2p/tcp'
import { multiaddr, protocols } from '@multiformats/multiaddr'
Expand Down Expand Up @@ -58,7 +58,10 @@ export class Server implements Libp2pServer {

this.multiaddr = multiaddr
this.libp2p = libp2pNode
this.tcp = tcp()()
this.tcp = tcp()({
// @ts-expect-error this field will be present post v1
logger: defaultLogger()
})
this.listener = this.tcp.createListener({
handler: this.handleConnection.bind(this),
upgrader: passThroughUpgrader
Expand Down

0 comments on commit 6f4728c

Please sign in to comment.