mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
update logging.
This commit is contained in:
parent
55a2b14aea
commit
d068698836
@ -139,7 +139,7 @@ func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.i
|
|||||||
log.Warn().
|
log.Warn().
|
||||||
Str("module", "capture").
|
Str("module", "capture").
|
||||||
Str("submodule", "gstreamer").
|
Str("submodule", "gstreamer").
|
||||||
Int("pipeline-id", int(pipelineID)).
|
Int("pipeline_id", int(pipelineID)).
|
||||||
Msgf("discarding sample, pipeline not found")
|
Msgf("discarding sample, pipeline not found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,6 +153,6 @@ func goPipelineLog(levelUnsafe *C.char, msgUnsafe *C.char, pipelineID C.int) {
|
|||||||
log.WithLevel(level).
|
log.WithLevel(level).
|
||||||
Str("module", "capture").
|
Str("module", "capture").
|
||||||
Str("submodule", "gstreamer").
|
Str("submodule", "gstreamer").
|
||||||
Int("pipeline-id", int(pipelineID)).
|
Int("pipeline_id", int(pipelineID)).
|
||||||
Msg(msg)
|
Msg(msg)
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,10 @@ func (session *SessionCtx) SetWebSocketConnected(websocketPeer types.WebSocketPe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.logger.Info().
|
||||||
|
Bool("connected", connected).
|
||||||
|
Msg("set websocket connected")
|
||||||
|
|
||||||
session.state.IsConnected = connected
|
session.state.IsConnected = connected
|
||||||
|
|
||||||
if connected {
|
if connected {
|
||||||
@ -136,6 +140,10 @@ func (session *SessionCtx) SetWebRTCConnected(webrtcPeer types.WebRTCPeer, conne
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.logger.Info().
|
||||||
|
Bool("connected", connected).
|
||||||
|
Msg("set webrtc connected")
|
||||||
|
|
||||||
session.state.IsWatching = connected
|
session.state.IsWatching = connected
|
||||||
session.manager.emmiter.Emit("state_changed", session)
|
session.manager.emmiter.Emit("state_changed", session)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pion/ice/v2"
|
"github.com/pion/ice/v2"
|
||||||
@ -48,6 +49,7 @@ func New(desktop types.DesktopManager, capture types.CaptureManager, config *con
|
|||||||
type WebRTCManagerCtx struct {
|
type WebRTCManagerCtx struct {
|
||||||
logger zerolog.Logger
|
logger zerolog.Logger
|
||||||
config *config.WebRTC
|
config *config.WebRTC
|
||||||
|
peerId int32
|
||||||
|
|
||||||
desktop types.DesktopManager
|
desktop types.DesktopManager
|
||||||
capture types.CaptureManager
|
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) {
|
func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID string) (*webrtc.SessionDescription, error) {
|
||||||
|
id := atomic.AddInt32(&manager.peerId, 1)
|
||||||
|
|
||||||
// add session id to logger context
|
// 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")
|
logger.Info().Msg("creating webrtc peer")
|
||||||
|
|
||||||
// all audios must have the same codec
|
// 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) {
|
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) {
|
connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {
|
||||||
|
Loading…
Reference in New Issue
Block a user