Remove some logs. (#2484)

* Remove some logs.

Also, changing Errorw -> Warnw in a bunch of places.
Going to move towards using `Errorw` for cases where a functionally
unexpected condition happens, i.e by design a condition should not
happen yet it triggered kind of scenarios.

* log error
This commit is contained in:
Raja Subramanian
2024-02-15 18:05:50 +05:30
committed by GitHub
parent e4c112929c
commit d216f94ac1
3 changed files with 16 additions and 21 deletions
+3 -3
View File
@@ -344,7 +344,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *trackSubscription) {
default: default:
// all other errors // all other errors
if s.durationSinceStart() > subscriptionTimeout { if s.durationSinceStart() > subscriptionTimeout {
s.logger.Errorw("failed to subscribe, triggering error handler", err, s.logger.Warnw("failed to subscribe, triggering error handler", err,
"attempt", numAttempts, "attempt", numAttempts,
) )
s.maybeRecordError(m.params.Telemetry, m.params.Participant.ID(), err, false) s.maybeRecordError(m.params.Telemetry, m.params.Participant.ID(), err, false)
@@ -365,7 +365,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *trackSubscription) {
if s.needsUnsubscribe() { if s.needsUnsubscribe() {
if err := m.unsubscribe(s); err != nil { if err := m.unsubscribe(s); err != nil {
s.logger.Errorw("failed to unsubscribe", err) s.logger.Warnw("failed to unsubscribe", err)
} else { } else {
// successfully unsubscribed, remove from map // successfully unsubscribed, remove from map
m.lock.Lock() m.lock.Lock()
@@ -383,7 +383,7 @@ func (m *SubscriptionManager) reconcileSubscription(s *trackSubscription) {
// if a publisher leaves or closes the source track, SubscribedTrack will be closed as well and it will go // if a publisher leaves or closes the source track, SubscribedTrack will be closed as well and it will go
// back to needsSubscribe state // back to needsSubscribe state
if s.durationSinceStart() > subscriptionTimeout { if s.durationSinceStart() > subscriptionTimeout {
s.logger.Errorw("track not bound after timeout", nil) s.logger.Warnw("track not bound after timeout", nil)
s.maybeRecordError(m.params.Telemetry, m.params.Participant.ID(), ErrTrackNotBound, false) s.maybeRecordError(m.params.Telemetry, m.params.Participant.ID(), ErrTrackNotBound, false)
m.params.OnSubscriptionError(s.trackID, true, ErrTrackNotBound) m.params.OnSubscriptionError(s.trackID, true, ErrTrackNotBound)
} }
+12 -18
View File
@@ -326,7 +326,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
if len(params.SimTracks) > 0 { if len(params.SimTracks) > 0 {
f, err := NewUnhandleSimulcastInterceptorFactory(UnhandleSimulcastTracks(params.SimTracks)) f, err := NewUnhandleSimulcastInterceptorFactory(UnhandleSimulcastTracks(params.SimTracks))
if err != nil { if err != nil {
params.Logger.Errorw("NewUnhandleSimulcastInterceptorFactory failed", err) params.Logger.Warnw("NewUnhandleSimulcastInterceptorFactory failed", err)
} else { } else {
ir.Add(f) ir.Add(f)
} }
@@ -356,7 +356,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
params.Logger.Debugw("set rtx twcc and ext id", "ssrc", info.SSRC, "twccExtID", twccExtID) params.Logger.Debugw("set rtx twcc and ext id", "ssrc", info.SSRC, "twccExtID", twccExtID)
buffer.SetTWCCAndExtID(params.Twcc, uint8(twccExtID)) buffer.SetTWCCAndExtID(params.Twcc, uint8(twccExtID))
} else { } else {
params.Logger.Errorw("failed to get buffer for rtx stream", nil, "ssrc", info.SSRC) params.Logger.Warnw("failed to get buffer for rtx stream", nil, "ssrc", info.SSRC)
} }
} }
} }
@@ -604,7 +604,7 @@ func (t *PCTransport) handleConnectionFailed(forceShortConn bool) {
if isShort { if isShort {
pair, err := t.getSelectedPair() pair, err := t.getSelectedPair()
if err != nil { if err != nil {
t.params.Logger.Errorw("short ICE connection", err, "duration", duration) t.params.Logger.Warnw("short ICE connection", err, "duration", duration)
} else { } else {
t.params.Logger.Infow("short ICE connection", "pair", pair, "duration", duration) t.params.Logger.Infow("short ICE connection", "pair", pair, "duration", duration)
} }
@@ -632,11 +632,6 @@ func (t *PCTransport) onICEConnectionStateChange(state webrtc.ICEConnectionState
case webrtc.ICEConnectionStateChecking: case webrtc.ICEConnectionStateChecking:
t.setICEStartedAt(time.Now()) t.setICEStartedAt(time.Now())
case webrtc.ICEConnectionStateDisconnected:
t.params.Logger.Infow("ice connection state change unexpected", "state", state.String())
case webrtc.ICEConnectionStateFailed:
t.params.Logger.Debugw("ice connection state change unexpected", "state", state.String())
} }
} }
@@ -652,7 +647,6 @@ func (t *PCTransport) onPeerConnectionStateChange(state webrtc.PeerConnectionSta
t.maybeNotifyFullyEstablished() t.maybeNotifyFullyEstablished()
} }
case webrtc.PeerConnectionStateFailed: case webrtc.PeerConnectionStateFailed:
t.params.Logger.Infow("peer connection failed")
t.clearConnTimer() t.clearConnTimer()
t.handleConnectionFailed(false) t.handleConnectionFailed(false)
} }
@@ -823,7 +817,7 @@ func (t *PCTransport) CreateDataChannel(label string, dci *webrtc.DataChannelIni
dcErrorHandler := func(err error) { dcErrorHandler := func(err error) {
if !errors.Is(err, sctp.ErrResetPacketInStateNotExist) && !errors.Is(err, sctp.ErrChunk) { if !errors.Is(err, sctp.ErrResetPacketInStateNotExist) && !errors.Is(err, sctp.ErrChunk) {
t.params.Logger.Errorw(dc.Label()+" data channel error", err) t.params.Logger.Warnw(dc.Label()+" data channel error", err)
} }
} }
@@ -848,7 +842,7 @@ func (t *PCTransport) CreateDataChannel(label string, dci *webrtc.DataChannelIni
t.lossyDC.OnClose(dcCloseHandler) t.lossyDC.OnClose(dcCloseHandler)
t.lossyDC.OnError(dcErrorHandler) t.lossyDC.OnError(dcErrorHandler)
default: default:
t.params.Logger.Errorw("unknown data channel label", nil, "label", dc.Label()) t.params.Logger.Warnw("unknown data channel label", nil, "label", dc.Label())
} }
t.lock.Unlock() t.lock.Unlock()
@@ -864,7 +858,7 @@ func (t *PCTransport) CreateDataChannelIfEmpty(dcLabel string, dci *webrtc.DataC
case LossyDataChannel: case LossyDataChannel:
dc = t.lossyDC dc = t.lossyDC
default: default:
t.params.Logger.Errorw("unknown data channel label", nil, "label", label) t.params.Logger.Warnw("unknown data channel label", nil, "label", label)
err = errors.New("unknown data channel label") err = errors.New("unknown data channel label")
} }
t.lock.RUnlock() t.lock.RUnlock()
@@ -1164,7 +1158,7 @@ func (t *PCTransport) initPCWithPreviousAnswer(previousAnswer webrtc.SessionDesc
// because sdp can negotiate multi times before migration.(it will sticky to the last m-line atfirst negotiate) // because sdp can negotiate multi times before migration.(it will sticky to the last m-line atfirst negotiate)
// so use a dummy pc to negotiate sdp to fixed the datachannel's mid at same position with previous answer // so use a dummy pc to negotiate sdp to fixed the datachannel's mid at same position with previous answer
if err := t.preparePC(previousAnswer); err != nil { if err := t.preparePC(previousAnswer); err != nil {
t.params.Logger.Errorw("prepare pc for migration failed", err) t.params.Logger.Warnw("prepare pc for migration failed", err)
return senders, err return senders, err
} }
continue continue
@@ -1202,7 +1196,7 @@ func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription) {
if t.pc.RemoteDescription() == nil && t.previousAnswer == nil { if t.pc.RemoteDescription() == nil && t.previousAnswer == nil {
t.previousAnswer = answer t.previousAnswer = answer
if senders, err := t.initPCWithPreviousAnswer(*t.previousAnswer); err != nil { if senders, err := t.initPCWithPreviousAnswer(*t.previousAnswer); err != nil {
t.params.Logger.Errorw("initPCWithPreviousAnswer failed", err) t.params.Logger.Warnw("initPCWithPreviousAnswer failed", err)
t.lock.Unlock() t.lock.Unlock()
t.params.Handler.OnNegotiationFailed() t.params.Handler.OnNegotiationFailed()
@@ -1211,7 +1205,7 @@ func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription) {
// in migration case, can't reuse transceiver before negotiated except track subscribed at previous node // in migration case, can't reuse transceiver before negotiated except track subscribed at previous node
t.canReuseTransceiver = false t.canReuseTransceiver = false
if err := t.parseTrackMid(*offer, senders); err != nil { if err := t.parseTrackMid(*offer, senders); err != nil {
t.params.Logger.Errorw("parse previous offer failed", err, "offer", offer.SDP) t.params.Logger.Warnw("parse previous offer failed", err, "offer", offer.SDP)
} }
} }
} }
@@ -1251,7 +1245,7 @@ func (t *PCTransport) postEvent(event event) {
err := t.handleEvent(&event) err := t.handleEvent(&event)
if err != nil { if err != nil {
if !t.isClosed.Load() { if !t.isClosed.Load() {
t.params.Logger.Errorw("error handling event", err, "event", event.String()) t.params.Logger.Warnw("error handling event", err, "event", event.String())
t.params.Handler.OnNegotiationFailed() t.params.Handler.OnNegotiationFailed()
} }
} }
@@ -1398,7 +1392,7 @@ func (t *PCTransport) setNegotiationState(state transport.NegotiationState) {
func (t *PCTransport) filterCandidates(sd webrtc.SessionDescription, preferTCP bool) webrtc.SessionDescription { func (t *PCTransport) filterCandidates(sd webrtc.SessionDescription, preferTCP bool) webrtc.SessionDescription {
parsed, err := sd.Unmarshal() parsed, err := sd.Unmarshal()
if err != nil { if err != nil {
t.params.Logger.Errorw("could not unmarshal SDP to filter candidates", err) t.params.Logger.Warnw("could not unmarshal SDP to filter candidates", err)
return sd return sd
} }
@@ -1428,7 +1422,7 @@ func (t *PCTransport) filterCandidates(sd webrtc.SessionDescription, preferTCP b
bytes, err := parsed.Marshal() bytes, err := parsed.Marshal()
if err != nil { if err != nil {
t.params.Logger.Errorw("could not marshal SDP to filter candidates", err) t.params.Logger.Warnw("could not marshal SDP to filter candidates", err)
return sd return sd
} }
sd.SDP = string(bytes) sd.SDP = string(bytes)
+1
View File
@@ -1641,6 +1641,7 @@ func (d *DownTrack) retransmitPackets(nacks []uint16) {
"eosn", epm.extSequenceNumber, "eosn", epm.extSequenceNumber,
"eots", epm.extTimestamp, "eots", epm.extTimestamp,
"sid", epm.layer, "sid", epm.layer,
"error", err,
) )
// TODO-VP9-DEBUG-REMOVE-END // TODO-VP9-DEBUG-REMOVE-END
nackMisses++ nackMisses++