diff --git a/internal/capture/gst/gst.go b/internal/capture/gst/gst.go index e0a50ae9..d2cb1781 100644 --- a/internal/capture/gst/gst.go +++ b/internal/capture/gst/gst.go @@ -139,7 +139,7 @@ func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.i log.Warn(). Str("module", "capture"). Str("submodule", "gstreamer"). - Int("pipeline-id", int(pipelineID)). + Int("pipeline_id", int(pipelineID)). Msgf("discarding sample, pipeline not found") } } @@ -153,6 +153,6 @@ func goPipelineLog(levelUnsafe *C.char, msgUnsafe *C.char, pipelineID C.int) { log.WithLevel(level). Str("module", "capture"). Str("submodule", "gstreamer"). - Int("pipeline-id", int(pipelineID)). + Int("pipeline_id", int(pipelineID)). Msg(msg) } diff --git a/internal/session/session.go b/internal/session/session.go index 6daaee81..4ae9249a 100644 --- a/internal/session/session.go +++ b/internal/session/session.go @@ -83,6 +83,10 @@ func (session *SessionCtx) SetWebSocketConnected(websocketPeer types.WebSocketPe return } + session.logger.Info(). + Bool("connected", connected). + Msg("set websocket connected") + session.state.IsConnected = connected if connected { @@ -136,6 +140,10 @@ func (session *SessionCtx) SetWebRTCConnected(webrtcPeer types.WebRTCPeer, conne return } + session.logger.Info(). + Bool("connected", connected). + Msg("set webrtc connected") + session.state.IsWatching = connected session.manager.emmiter.Emit("state_changed", session) diff --git a/internal/webrtc/manager.go b/internal/webrtc/manager.go index d6debfe8..3f607a34 100644 --- a/internal/webrtc/manager.go +++ b/internal/webrtc/manager.go @@ -4,6 +4,7 @@ import ( "fmt" "net" "strings" + "sync/atomic" "time" "github.com/pion/ice/v2" @@ -48,6 +49,7 @@ func New(desktop types.DesktopManager, capture types.CaptureManager, config *con type WebRTCManagerCtx struct { logger zerolog.Logger config *config.WebRTC + peerId int32 desktop types.DesktopManager capture types.CaptureManager @@ -118,8 +120,10 @@ func (manager *WebRTCManagerCtx) ICEServers() []types.ICEServer { } func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID string) (*webrtc.SessionDescription, error) { + id := atomic.AddInt32(&manager.peerId, 1) + // add session id to logger context - logger := manager.logger.With().Str("session_id", session.ID()).Logger() + logger := manager.logger.With().Str("session_id", session.ID()).Int32("peer_id", id).Logger() logger.Info().Msg("creating webrtc peer") // all audios must have the same codec @@ -292,7 +296,7 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin }) connection.OnDataChannel(func(dc *webrtc.DataChannel) { - logger.Info().Interface("data-channel", dc).Msg("got remote data channel") + logger.Info().Interface("data_channel", dc).Msg("got remote data channel") }) connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {