mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
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.
This commit is contained in:
parent
97bab94e67
commit
2b04357550
1 changed files with 9 additions and 1 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dchest/uniuri"
|
"github.com/dchest/uniuri"
|
||||||
|
"github.com/pion/logging"
|
||||||
"github.com/pion/webrtc"
|
"github.com/pion/webrtc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -154,7 +155,14 @@ func (c *WebRTCPeer) preparePeerConnection() error {
|
||||||
c.pc.Close()
|
c.pc.Close()
|
||||||
c.pc = nil
|
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)
|
s.SetTrickle(true)
|
||||||
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
api := webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
||||||
pc, err := api.NewPeerConnection(*c.config)
|
pc, err := api.NewPeerConnection(*c.config)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue