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

chore: introduce libp2p-logging #5725

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

kamuik16
Copy link
Contributor

@kamuik16 kamuik16 commented Dec 8, 2024

Description

Fixes #4992

Based on the conversation in #4992.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@drHuangMHT drHuangMHT mentioned this pull request Dec 9, 2024
4 tasks
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.
Overall looks good to me, left some minor comments. We also need CHANGELOG.md entries.
I think when Thomas mentioned the publish = false wasn't accounting what he said later on #4992 (comment)

misc/logging/Cargo.toml Show resolved Hide resolved
misc/logging/src/lib.rs Outdated Show resolved Hide resolved
@kamuik16
Copy link
Contributor Author

kamuik16 commented Dec 9, 2024

Thanks for this. Overall looks good to me, left some minor comments. We also need CHANGELOG.md entries. I think when Thomas mentioned the publish = false wasn't accounting what he said later on #4992 (comment)

We also need CHANGELOG.md entries.

Which ones do you suggest? Since the logging is only used in testing part and is not the part of public API, I don't think it needs CHANGELOG.md entries.

@jxs
Copy link
Member

jxs commented Dec 9, 2024

Thanks for this. Overall looks good to me, left some minor comments. We also need CHANGELOG.md entries. I think when Thomas mentioned the publish = false wasn't accounting what he said later on #4992 (comment)

We also need CHANGELOG.md entries.

Which ones do you suggest? Since the logging is only used in testing part and is not the part of public API, I don't think it needs CHANGELOG.md entries.

the ones we publish, libp2p-perf and libp2p-server

@kamuik16
Copy link
Contributor Author

Thanks for this. Overall looks good to me, left some minor comments. We also need CHANGELOG.md entries. I think when Thomas mentioned the publish = false wasn't accounting what he said later on #4992 (comment)

We also need CHANGELOG.md entries.

Which ones do you suggest? Since the logging is only used in testing part and is not the part of public API, I don't think it needs CHANGELOG.md entries.

the ones we publish, libp2p-perf and libp2p-server

added CHANGELOG.md entries.

@kamuik16
Copy link
Contributor Author

@jxs would appreciate your further review here :)

@kamuik16 kamuik16 requested a review from jxs December 13, 2024 04:24
@kamuik16
Copy link
Contributor Author

semver check is just failing because the libp2p-logging crate has not been published yet.

Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Krishang, thanks for the ping!
Giving more thought about this one taking into account we'll have to release it and be yet another crate to maintain in exchange for duplicating a couple lines across the repo it's not clear its value, but I am willing to move forward, wdyt @elenaf9 @dariusc93 @guillaumemichel @drHuangMHT

@kamuik16
Copy link
Contributor Author

kamuik16 commented Dec 13, 2024

LGTM, thanks Krishang, thanks for the ping! Giving more thought about this one taking into account we'll have to release it and be yet another crate to maintain in exchange for duplicating a couple lines across the repo it's not clear its value, but I am willing to move forward, wdyt @elenaf9 @dariusc93 @guillaumemichel @drHuangMHT

yeah, that's why I was suggesting to keep the publish = false and remove its usage from the packages that are released.

Majority of the usage of this is in the tests, so no need to publish it.

@jxs
Copy link
Member

jxs commented Dec 13, 2024

LGTM, thanks Krishang, thanks for the ping! Giving more thought about this one taking into account we'll have to release it and be yet another crate to maintain in exchange for duplicating a couple lines across the repo it's not clear its value, but I am willing to move forward, wdyt @elenaf9 @dariusc93 @guillaumemichel @drHuangMHT

yeah, that's why I was suggesting to keep the publish = false and remove its usage from the packages that are released.

Majority of the usage of this is in the tests, so no need to publish it.

but then we still need to have duplicated log initialization code on the published crates (libp2p-perf and libp2p-server) right? Or how would you address it? Nonetheless thanks for your patience bearing with the process Krishang.

Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's why I was suggesting to keep the publish = false and remove its usage from the packages that are released.

Majority of the usage of this is in the tests, so no need to publish it.

I am also leaning towards not publishing libp2p-logging, and instead duplicating the lines in the two published crates.
It's not ideal, but it still:

  • avoids the verbose let _ = tracing_subscriber::fmt()... in all other tests/ examples
  • doesn't require us to maintain yet another published crate.

misc/logging/src/lib.rs Outdated Show resolved Hide resolved
misc/logging/src/lib.rs Outdated Show resolved Hide resolved
misc/logging/src/lib.rs Outdated Show resolved Hide resolved
@kamuik16
Copy link
Contributor Author

yeah, that's why I was suggesting to keep the publish = false and remove its usage from the packages that are released.
Majority of the usage of this is in the tests, so no need to publish it.

I am also leaning towards not publishing libp2p-logging, and instead duplicating the lines in the two published crates. It's not ideal, but it still:

  • avoids the verbose let _ = tracing_subscriber::fmt()... in all other tests/ examples
  • doesn't require us to maintain yet another published crate.

yep, I do agree on this, it's better to have 2-3 lines of duplicated code rather than maintaining a whole crate.

I have reverted back the changes on the published crates and made libp2p-logging with publish = false.

Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up @kamuik16!

I just noticed that the new libp2p_logging crate is not used by any crates in examples/. Was that on purpose / is there a reason why it can't be used there?

misc/logging/CHANGELOG.md Show resolved Hide resolved
misc/multistream-select/src/dialer_select.rs Show resolved Hide resolved
protocols/stream/tests/lib.rs Show resolved Hide resolved
swarm/src/lib.rs Outdated Show resolved Hide resolved
misc/logging/src/lib.rs Outdated Show resolved Hide resolved
@kamuik16
Copy link
Contributor Author

kamuik16 commented Dec 14, 2024

Thanks for the follow-up @kamuik16!

I just noticed that the new libp2p_logging crate is not used by any crates in examples/. Was that on purpose / is there a reason why it can't be used there?

yeah, that was on purpose, examples are meant for user to copy paste and run. If we don't publish the crate, examples would compile in our repository but users who are still new and just want to copy paste and run them, won't be able to do so.

does this make sense?

@elenaf9 elenaf9 mentioned this pull request Dec 14, 2024
4 tasks
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.

tracing_subscriber should log to stderr
3 participants