Skip to content

feat: allow creating scoped loggers #3214

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

Merged
merged 4 commits into from
Jul 9, 2025
Merged

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Jul 8, 2025

Adds newScope function to loggers that creates a logger under the current context.

This is ultimately to allow unambiguous cascading log prefixes of:

libp2p -> transport -> connection -> muxer -> stream

E.g. libp2p:tcp:connection:outbound:1:yamux:stream:inbound:1

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

Adds `forComponent` function to loggers that creates a logger under
the current context.

This is to allow unambigious cascading log prefixes of:

`libp2p` -> `transport` -> `connection` -> `muxer` -> `stream`

E.g. `libp2p:tcp:connection:outbound:1:yamux:stream:inbound:1`
@achingbrain achingbrain requested a review from a team as a code owner July 8, 2025 17:27
@achingbrain achingbrain changed the title feat: allow creating sub loggers feat: allow creating scoped loggers Jul 9, 2025
@achingbrain achingbrain merged commit 58abe87 into main Jul 9, 2025
34 checks passed
@achingbrain achingbrain deleted the feat/create-sub-loggers branch July 9, 2025 09:03
@achingbrain
Copy link
Member Author

Refs: ipshipyard/roadmaps#22

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.

1 participant