@@ -14,10 +14,11 @@ var log = logging.Logger("webrtc-transport")
1414// pionLog is the logger provided to pion for internal logging
1515var pionLog = logging .Logger ("webrtc-transport-pion" )
1616
17- // pionLogger wraps the StandardLogger interface to provide a LeveledLogger interface
18- // as expected by pion
19- // Pion logs are too noisy and have invalid log levels. pionLogger downgrades all the
20- // logs to debug
17+ // pionLogger adapts pion's logger to go-libp2p's semantics.
18+ // Pion logs routine connection events (client disconnects, protocol mismatches,
19+ // state races) as ERROR/WARN, but these are normal operational noise from a
20+ // service perspective. We downgrade all pion logs to DEBUG to prevent log spam
21+ // while preserving debuggability when needed.
2122type pionLogger struct {
2223 * slog.Logger
2324}
@@ -37,32 +38,32 @@ func (l pionLogger) Debugf(s string, args ...interface{}) {
3738}
3839
3940func (l pionLogger ) Error (s string ) {
40- l .Logger .Error (s )
41+ l .Logger .Debug (s )
4142}
4243
4344func (l pionLogger ) Errorf (s string , args ... interface {}) {
44- if l .Logger .Enabled (context .Background (), slog .LevelError ) {
45- l .Logger .Error (fmt .Sprintf (s , args ... ))
45+ if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
46+ l .Logger .Debug (fmt .Sprintf (s , args ... ))
4647 }
4748}
4849
4950func (l pionLogger ) Info (s string ) {
50- l .Logger .Info (s )
51+ l .Logger .Debug (s )
5152}
5253
5354func (l pionLogger ) Infof (s string , args ... interface {}) {
54- if l .Logger .Enabled (context .Background (), slog .LevelInfo ) {
55- l .Logger .Info (fmt .Sprintf (s , args ... ))
55+ if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
56+ l .Logger .Debug (fmt .Sprintf (s , args ... ))
5657 }
5758}
5859
5960func (l pionLogger ) Warn (s string ) {
60- l .Logger .Warn (s )
61+ l .Logger .Debug (s )
6162}
6263
6364func (l pionLogger ) Warnf (s string , args ... interface {}) {
64- if l .Logger .Enabled (context .Background (), slog .LevelWarn ) {
65- l .Logger .Warn (fmt .Sprintf (s , args ... ))
65+ if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
66+ l .Logger .Debug (fmt .Sprintf (s , args ... ))
6667 }
6768}
6869
0 commit comments