Logging cleanup (#843)

* Logging cleanup

Changes log levels to better match significance

* fix lock
This commit is contained in:
David Zhao
2022-07-21 00:39:49 -07:00
committed by GitHub
parent f2e1e67e58
commit 53f51c8cb0
17 changed files with 45 additions and 55 deletions
+1 -1
View File
@@ -208,8 +208,8 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
}
}
t.params.Logger.Debugw("primary codec published, set potential codecs", "potential", potentialCodecs)
if len(potentialCodecs) > 0 {
t.params.Logger.Debugw("primary codec published, set potential codecs", "potential", potentialCodecs)
t.MediaTrackReceiver.SetPotentialCodecs(potentialCodecs, parameters.HeaderExtensions)
}
t.params.Telemetry.TrackPublished(
+1 -1
View File
@@ -466,7 +466,7 @@ func (t *MediaTrackReceiver) removeSubscriber(subscriberID livekit.ParticipantID
}
func (t *MediaTrackReceiver) RemoveAllSubscribers(willBeResumed bool) {
t.params.Logger.Debugw("removing all subscribers")
t.params.Logger.Infow("removing all subscribers")
for _, subscriberID := range t.MediaTrackSubscriptions.GetAllSubscribers() {
t.RemoveSubscriber(subscriberID, willBeResumed)
}
+2 -2
View File
@@ -754,7 +754,7 @@ func (t *MediaTrackSubscriptions) downTrackClosed(
if sender == nil {
return
}
sub.GetLogger().Infow("removing peerconnection track",
sub.GetLogger().Debugw("removing PeerConnection track",
"publisher", subTrack.PublisherIdentity(),
"publisherID", subTrack.PublisherID(),
"kind", t.params.MediaTrack.Kind(),
@@ -767,7 +767,7 @@ func (t *MediaTrackSubscriptions) downTrackClosed(
if _, ok := err.(*rtcerr.InvalidStateError); !ok {
// most of these are safe to ignore, since the track state might have already
// been set to Inactive
sub.GetLogger().Infow("could not remove remoteTrack from forwarder",
sub.GetLogger().Debugw("could not remove remoteTrack from forwarder",
"error", err,
"publisher", subTrack.PublisherIdentity(),
"publisherID", subTrack.PublisherID(),
+7 -15
View File
@@ -714,7 +714,7 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
return nil
}
p.params.Logger.Infow("closing participant", "sendLeave", sendLeave, "reason", reason)
p.params.Logger.Infow("closing participant", "sendLeave", sendLeave, "reason", reason.String())
// send leave message
if sendLeave {
_ = p.writeMessage(&livekit.SignalResponse{
@@ -884,15 +884,6 @@ func (p *ParticipantImpl) GetConnectionQuality() *livekit.ConnectionQualityInfo
}
rating := connectionquality.Score2Rating(avgScore)
if rating != livekit.ConnectionQuality_EXCELLENT {
p.params.Logger.Infow("connection quality not optimal",
"totalScore", totalScore,
"numTracks", numTracks,
"rating", rating,
"publisherScores", publisherScores,
"subscriberScores", subscriberScores,
)
}
return &livekit.ConnectionQualityInfo{
ParticipantSid: string(p.ID()),
@@ -1314,7 +1305,7 @@ func (p *ParticipantImpl) handlePrimaryStateChange(state webrtc.PeerConnectionSt
}
if primaryPC.ConnectionState() != webrtc.PeerConnectionStateConnected {
p.params.Logger.Infow("closing disconnected participant")
p.Close(true, types.ParticipantCloseReasonPeerConnectionDisconnected)
_ = p.Close(true, types.ParticipantCloseReasonPeerConnectionDisconnected)
}
})
p.lock.Unlock()
@@ -1580,7 +1571,7 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
if req.Sid != "" {
track := p.GetPublishedTrack(livekit.TrackID(req.Sid))
if track == nil {
p.params.Logger.Infow("track not found for new codec publish", "trackID", req.Sid)
p.params.Logger.Infow("could not find existing track for multi-codec simulcast", "trackID", req.Sid)
return nil
}
@@ -2098,7 +2089,7 @@ func (p *ParticipantImpl) setDowntracksConnected() {
func (p *ParticipantImpl) CacheDownTrack(trackID livekit.TrackID, rtpTransceiver *webrtc.RTPTransceiver, forwarderState sfu.ForwarderState) {
p.lock.Lock()
if existing := p.cachedDownTracks[trackID]; existing != nil && existing.transceiver != rtpTransceiver {
p.params.Logger.Infow("cached transceiver change", "trackID", trackID)
p.params.Logger.Infow("cached transceiver changed", "trackID", trackID)
}
p.cachedDownTracks[trackID] = &downTrackState{transceiver: rtpTransceiver, forwarder: forwarderState}
p.lock.Unlock()
@@ -2128,7 +2119,7 @@ func (p *ParticipantImpl) GetCachedDownTrack(trackID livekit.TrackID) (*webrtc.R
}
func (p *ParticipantImpl) handleNegotiationFailed() {
p.params.Logger.Infow("negotiation failed, notify client do full reconnect")
p.params.Logger.Infow("negotiation failed, starting full reconnect")
_ = p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Leave{
Leave: &livekit.LeaveRequest{
@@ -2202,7 +2193,8 @@ func (p *ParticipantImpl) ProcessSubscriptionRequestsQueue(trackID livekit.Track
}
default:
p.params.Logger.Warnw("unknown request type", nil)
p.params.Logger.Warnw("unknown request type", nil,
"requestType", request.requestType)
// let the queue move forward
p.ClearInProgressAndProcessSubscriptionRequestsQueue(trackID)
+2 -2
View File
@@ -32,7 +32,7 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
return nil
}
if err := participant.AddICECandidate(candidateInit, msg.Trickle.Target); err != nil {
pLogger.Warnw("could not handle trickle", err)
pLogger.Warnw("could not add ICE candidate", err)
}
case *livekit.SignalRequest_Mute:
participant.SetTrackMuted(livekit.TrackID(msg.Mute.Sid), msg.Mute.Muted, false)
@@ -65,7 +65,7 @@ func HandleParticipantSignal(room types.Room, participant types.LocalParticipant
continue
}
pLogger.Debugw("updated subscribed track settings", "trackID", sid, "settings", msg.TrackSetting)
pLogger.Infow("updated subscribed track settings", "trackID", sid, "settings", msg.TrackSetting)
}
case *livekit.SignalRequest_UpdateLayers:
err := room.UpdateVideoLayers(participant, msg.UpdateLayers)
+2 -3
View File
@@ -374,8 +374,8 @@ func (t *PCTransport) createAndSendOffer(options *webrtc.OfferOptions) error {
// restart without current remote description, sent current local description again to try recover
offer := t.pc.LocalDescription()
if offer == nil {
// it should not happend, check for safety
t.params.Logger.Infow("ice restart without local offer")
// it should not happen, log just in case
t.params.Logger.Warnw("ice restart without local offer", nil)
return ErrIceRestartWithoutLocalSDP
} else {
t.negotiationState = negotiationRetry
@@ -449,7 +449,6 @@ func (t *PCTransport) createAndSendOffer(options *webrtc.OfferOptions) error {
failed := t.negotiationState != negotiationStateNone
t.lock.RUnlock()
if t.negotiateCounter.Load() == negotiateVersion && failed {
t.params.Logger.Infow("negotiation timeout")
if t.onNegotiationFailed != nil {
t.onNegotiationFailed()
}