[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Connect pion library logger with snowflake log



commit 2b04357550a9fd827b8c1f35164de5ec42a63c7c
Author: Cecylia Bocovich <cohosh@xxxxxxxxxxxxxx>
Date:   Wed Sep 4 15:00:58 2019 -0400

    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.
---
 client/lib/webrtc.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/client/lib/webrtc.go b/client/lib/webrtc.go
index dbc205e..e3245b6 100644
--- a/client/lib/webrtc.go
+++ b/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.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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits