Commit 2b043575 authored by Cecylia Bocovich's avatar Cecylia Bocovich
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.
parent 97bab94e
......@@ -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.LogLevelError
logFactory.Writer = log.Writer()
s := webrtc.SettingEngine{
LoggerFactory: logFactory,
}
s.SetTrickle(true)
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
pc, err := api.NewPeerConnection(*c.config)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment