fix(webrtc): use debug level for pion errors #3426
Merged
+14
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
go-libp2p 0.44 and 0.45 log operational webrtc noise ad loud ERRORs
This impacts projects like kubo, which run webrtc-direct listener by default:
Analysis
Pre-v0.44 (Working State)
PR #2915 by @sukunrt deliberately downgraded all pion logs to Debug level because "Pion logs are too noisy and have invalid log levels". This worked correctly for ~1 year without issues.
v0.44.0 (Regression)
PR #3364 by @MarcoPolo migrated from go-log/v2 to log/slog but accidentally reverted the pion log level downgrade. The migration kept the comment claiming logs were downgraded but changed the implementation to log Error/Warn/Info at their face values, causing routine connection events to spam error logs.
Solution
Similar to PR #3413 which fixed this issue for websocket transport, WebRTC transport needs the same treatment. Pion logs client disconnects, protocol mismatches, and state races as ERROR/WARN, but these are normal operational noise from a service perspective, not actual errors requiring operator attention.
This restores PR #2915 behavior: downgrade all pion logs to Debug level.
Users who need to debug WebRTC issues can still use that level.
Fixes ipfs/kubo#11053