Add remote participant context to logger (#815)
This commit is contained in:
+2
-1
@@ -129,7 +129,7 @@ func Recover() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// logger helpers
|
// logger helpers
|
||||||
func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity, sid livekit.ParticipantID) logger.Logger {
|
func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity, sid livekit.ParticipantID, isRemote bool) logger.Logger {
|
||||||
lr := logr.Logger(l)
|
lr := logr.Logger(l)
|
||||||
if identity != "" {
|
if identity != "" {
|
||||||
lr = lr.WithValues("participant", identity)
|
lr = lr.WithValues("participant", identity)
|
||||||
@@ -137,6 +137,7 @@ func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity
|
|||||||
if sid != "" {
|
if sid != "" {
|
||||||
lr = lr.WithValues("pID", sid)
|
lr = lr.WithValues("pID", sid)
|
||||||
}
|
}
|
||||||
|
lr = lr.WithValues("remote", isRemote)
|
||||||
return logger.Logger(lr)
|
return logger.Logger(lr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ func (r *RoomManager) StartSession(
|
|||||||
rtcConf := *r.rtcConfig
|
rtcConf := *r.rtcConfig
|
||||||
rtcConf.SetBufferFactory(room.GetBufferFactory())
|
rtcConf.SetBufferFactory(room.GetBufferFactory())
|
||||||
sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix))
|
sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix))
|
||||||
pLogger := rtc.LoggerWithParticipant(room.Logger, pi.Identity, sid)
|
pLogger := rtc.LoggerWithParticipant(room.Logger, pi.Identity, sid, false)
|
||||||
protoRoom := room.ToProto()
|
protoRoom := room.ToProto()
|
||||||
participant, err = rtc.NewParticipant(rtc.ParticipantParams{
|
participant, err = rtc.NewParticipant(rtc.ParticipantParams{
|
||||||
Identity: pi.Identity,
|
Identity: pi.Identity,
|
||||||
@@ -401,7 +401,9 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa
|
|||||||
|
|
||||||
pLogger := rtc.LoggerWithParticipant(
|
pLogger := rtc.LoggerWithParticipant(
|
||||||
rtc.LoggerWithRoom(logger.GetDefaultLogger(), room.Name(), room.ID()),
|
rtc.LoggerWithRoom(logger.GetDefaultLogger(), room.Name(), room.ID()),
|
||||||
participant.Identity(), participant.ID(),
|
participant.Identity(),
|
||||||
|
participant.ID(),
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
// send first refresh for cases when client token is close to expiring
|
// send first refresh for cases when client token is close to expiring
|
||||||
@@ -469,6 +471,7 @@ func (r *RoomManager) handleRTCMessage(ctx context.Context, roomName livekit.Roo
|
|||||||
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, room.ID()),
|
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, room.ID()),
|
||||||
identity,
|
identity,
|
||||||
sid,
|
sid,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
switch rm := msg.Message.(type) {
|
switch rm := msg.Message.(type) {
|
||||||
|
|||||||
@@ -183,7 +183,9 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
pLogger := rtc.LoggerWithParticipant(
|
pLogger := rtc.LoggerWithParticipant(
|
||||||
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, ""),
|
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, ""),
|
||||||
pi.Identity, "",
|
pi.Identity,
|
||||||
|
"",
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
// function exits when websocket terminates, it'll close the event reading off of response sink as well
|
// function exits when websocket terminates, it'll close the event reading off of response sink as well
|
||||||
|
|||||||
Reference in New Issue
Block a user