Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use logging component everywhere #2228

Merged
merged 2 commits into from
Nov 11, 2023

Conversation

achingbrain
Copy link
Member

Refactors all components to accept a ComponentLogger that lets us prefix log lines with peer ids/arbitrary strings, etc.

Closes #2207
Closes #2105

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

Refactors all components to accept a `ComponentLogger` that lets us
prefix log lines with peer ids/arbitrary strings, etc.
@achingbrain achingbrain requested a review from a team as a code owner November 10, 2023 15:22
@achingbrain achingbrain merged commit 8ae6c43 into release-v1.0 Nov 11, 2023
21 checks passed
@achingbrain achingbrain deleted the fix/use-per-component-logging branch November 11, 2023 07:06
achingbrain added a commit that referenced this pull request Nov 15, 2023
Refactors all components to accept a `ComponentLogger` that lets us
prefix log lines with peer ids/arbitrary strings, etc.
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Nov 27, 2023
Refactors all components to accept a `ComponentLogger` that lets us
prefix log lines with peer ids/arbitrary strings, etc.
@akim-bow
Copy link

akim-bow commented Dec 4, 2023

@achingbrain This is actually BREAKING CHANGE!
After this patch update libp2p gives an error

CodeError: logger not set\n at Object.get (file:///opt/actions-runner/_work/cli/cli/aqua-tests/node_modules/libp2p/dist/src/components.js:66:27)\n at new PersistentPeerStore (file:///opt/actions-runner/_work/cli/cli/aqua-tests/node_modules/@libp2p/peer-store/dist/src/index.js:13:31)\n at new Libp2pNode (file:///opt/actions-runner/_work/cli/cli/aqua-tests/node_modules/libp2p/dist/src/libp2p.js:67:63)\n at createLibp2pNode (file:///opt/actions-runner/_work/cli/cli/aqua-tests/node_modules/libp2p/dist/src/libp2p.js:339:12)\n at createLibp2p (file:///opt/actions-runner/_work/cli/cli/aqua-tests/node_modules/libp2p/dist/src/index.js:44:24)

I used "libp2p": "0.46.6"

@achingbrain
Copy link
Member Author

@akim-bow the last 0.46.x release was 0.46.21 - I think you may have some mixed dependency versions, you may need to remove your lockfiles and install again.

You should get @libp2p/peer-store@9.0.12 which is compatible with libp2p@0.46.21.

@akim-bow
Copy link

akim-bow commented Dec 5, 2023

@achingbrain
But why libp2p@0.46.6 compatible with @libp2p/peer-store@9.0.9 but not with @libp2p/peer-store@9.0.10?
This is patch update and libp2p dependencies use latest patch version automatically when installed, as libp2p specifies range(^) semver version:

"name": "libp2p",
...
"dependencies": {
  "@libp2p/peer-store": "^9.0.3",

There is no lockfile involved, my case is a clean installation of a libp2p of specific version. In my opinion, if dependency update requires updating dependent package - it should be marked as a BREAKING CHANGE.
The semver above actually says that "0.46.6 ver. will be compatible with following patch updates of peer-store package.

@achingbrain
Copy link
Member Author

You are quite right, unfortunately we are all human and sometimes we make mistakes.

Please ensure you have the latest 0.46.x version of libp2p and the latest 9.x version of @libp2p/peer-store installed and your problem should resolve itself.

@akim-bow
Copy link

akim-bow commented Dec 6, 2023

Thanks!

This was referenced Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants