Skip to content

Commit

Permalink
feat(rosenet-node, rosenet-relay): add config to enable libp2p logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkermani144 committed May 16, 2024
1 parent f5176d5 commit 5499c31
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/quiet-kings-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rosen-bridge/rosenet-relay': minor
'@rosen-bridge/rosenet-node': minor
---

add config to enable libp2p logs
2 changes: 2 additions & 0 deletions packages/rosenet-node/lib/createRoseNetNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { createLibp2p } from 'libp2p';

import {
addEventListeners,
libp2pLoggerFactory,
privateKeyToPeerId,
} from '@rosen-bridge/rosenet-utils';

Expand Down Expand Up @@ -112,6 +113,7 @@ const createRoseNetNode = async ({
runOnTransientConnection: true,
}),
},
logger: libp2pLoggerFactory(logger, config.debug?.libp2pComponents ?? []),
});
RoseNetNodeContext.logger.debug('RoseNet node created');

Expand Down
3 changes: 3 additions & 0 deletions packages/rosenet-node/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ export interface RoseNetNodeConfig {
privateKey: string;
port?: number;
whitelist?: string[];
debug?: {
libp2pComponents?: string[];
};
}
2 changes: 2 additions & 0 deletions packages/rosenet-relay/lib/createRoseNetRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { createLibp2p } from 'libp2p';

import {
addEventListeners,
libp2pLoggerFactory,
privateKeyToPeerId,
} from '@rosen-bridge/rosenet-utils';

Expand Down Expand Up @@ -83,6 +84,7 @@ const createRoseNetRelay = async ({
name: 'rosenet-relay',
version: packageJson.version,
},
logger: libp2pLoggerFactory(logger, config.debug?.libp2pComponents ?? []),
});

logger.debug('RoseNet relay created');
Expand Down
3 changes: 3 additions & 0 deletions packages/rosenet-relay/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ export interface RoseNetRelayConfig {
logger: AbstractLogger;
whitelist: string[];
maxReservations?: number;
debug?: {
libp2pComponents?: string[];
};
}

0 comments on commit 5499c31

Please sign in to comment.