Skip to content
Permalink
Browse files
Connect pion library logger with snowflake log
We need to set up the pion/webrtc logger to write output to the
snowflake log, otherwise the warnings we are getting from the pion
library are being lost.

Note: this requires go version 1.13 and later in order to use the
`log.Writer()` function.
  • Loading branch information
cohosh committed Sep 4, 2019
1 parent e5040c7 commit ee8ddfe579092a126434bae4cf83203caf1d818b
Showing with 9 additions and 1 deletion.
  1. +9 −1 client/lib/webrtc.go
@@ -9,6 +9,7 @@ import (
"time"

"github.com/dchest/uniuri"
"github.com/pion/logging"
"github.com/pion/webrtc"
)

@@ -154,7 +155,14 @@ func (c *WebRTCPeer) preparePeerConnection() error {
c.pc.Close()
c.pc = nil
}
s := webrtc.SettingEngine{}

logFactory := logging.NewDefaultLoggerFactory()
logFactory.DefaultLogLevel = logging.LogLevelTrace
logFactory.Writer = log.Writer()

s := webrtc.SettingEngine{
LoggerFactory: logFactory,
}
s.SetTrickle(true)
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
pc, err := api.NewPeerConnection(*c.config)

0 comments on commit ee8ddfe

Please sign in to comment.