mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 15:35:41 +00:00
Add remote participant context to logger (#815)
This commit is contained in:
@@ -129,7 +129,7 @@ func Recover() {
|
||||
}
|
||||
|
||||
// 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)
|
||||
if identity != "" {
|
||||
lr = lr.WithValues("participant", identity)
|
||||
@@ -137,6 +137,7 @@ func LoggerWithParticipant(l logger.Logger, identity livekit.ParticipantIdentity
|
||||
if sid != "" {
|
||||
lr = lr.WithValues("pID", sid)
|
||||
}
|
||||
lr = lr.WithValues("remote", isRemote)
|
||||
return logger.Logger(lr)
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ func (r *RoomManager) StartSession(
|
||||
rtcConf := *r.rtcConfig
|
||||
rtcConf.SetBufferFactory(room.GetBufferFactory())
|
||||
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()
|
||||
participant, err = rtc.NewParticipant(rtc.ParticipantParams{
|
||||
Identity: pi.Identity,
|
||||
@@ -401,7 +401,9 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa
|
||||
|
||||
pLogger := rtc.LoggerWithParticipant(
|
||||
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
|
||||
@@ -469,6 +471,7 @@ func (r *RoomManager) handleRTCMessage(ctx context.Context, roomName livekit.Roo
|
||||
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, room.ID()),
|
||||
identity,
|
||||
sid,
|
||||
false,
|
||||
)
|
||||
|
||||
switch rm := msg.Message.(type) {
|
||||
|
||||
@@ -183,7 +183,9 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
pLogger := rtc.LoggerWithParticipant(
|
||||
rtc.LoggerWithRoom(logger.GetDefaultLogger(), roomName, ""),
|
||||
pi.Identity, "",
|
||||
pi.Identity,
|
||||
"",
|
||||
false,
|
||||
)
|
||||
done := make(chan struct{})
|
||||
// function exits when websocket terminates, it'll close the event reading off of response sink as well
|
||||
|
||||
Reference in New Issue
Block a user