Merge branch 'supress_webrtc_logs'
This commit is contained in:
commit
7671a55a5c
|
@ -60,7 +60,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./.github/actions/go-common
|
- uses: ./.github/actions/go-common
|
||||||
- name: Some packages compile for WebAssembly
|
- name: Some packages compile for WebAssembly
|
||||||
run: GOOS=js GOARCH=wasm go build -v . ./storage ./tracker/...
|
run: GOOS=js GOARCH=wasm go build . ./storage ./tracker/...
|
||||||
|
|
||||||
torrentfs:
|
torrentfs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
// These build constraints are copied from webrtc's settingengine.go.
|
||||||
|
//go:build !js
|
||||||
|
// +build !js
|
||||||
|
|
||||||
|
package webtorrent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/pion/logging"
|
||||||
|
"github.com/pion/webrtc/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
var s = webrtc.SettingEngine{
|
||||||
|
// This could probably be done with better integration into anacrolix/log, but I'm not sure if
|
||||||
|
// it's worth the effort.
|
||||||
|
LoggerFactory: discardLoggerFactory{},
|
||||||
|
}
|
||||||
|
|
||||||
|
type discardLoggerFactory struct{}
|
||||||
|
|
||||||
|
func (discardLoggerFactory) NewLogger(scope string) logging.LeveledLogger {
|
||||||
|
return logging.NewDefaultLeveledLoggerForScope(scope, logging.LogLevelInfo, io.Discard)
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
// These build constraints are copied from webrtc's settingengine_js.go.
|
||||||
|
//go:build js && wasm
|
||||||
|
// +build js,wasm
|
||||||
|
|
||||||
|
package webtorrent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/pion/webrtc/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
// I'm not sure what to do for logging for JS. See
|
||||||
|
// https://gophers.slack.com/archives/CAK2124AG/p1649651943947579.
|
||||||
|
var s = webrtc.SettingEngine{}
|
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
"github.com/anacrolix/missinggo/v2/pproffd"
|
"github.com/anacrolix/missinggo/v2/pproffd"
|
||||||
"github.com/pion/datachannel"
|
"github.com/pion/datachannel"
|
||||||
|
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +15,6 @@ var (
|
||||||
metrics = expvar.NewMap("webtorrent")
|
metrics = expvar.NewMap("webtorrent")
|
||||||
api = func() *webrtc.API {
|
api = func() *webrtc.API {
|
||||||
// Enable the detach API (since it's non-standard but more idiomatic).
|
// Enable the detach API (since it's non-standard but more idiomatic).
|
||||||
s := webrtc.SettingEngine{}
|
|
||||||
s.DetachDataChannels()
|
s.DetachDataChannels()
|
||||||
return webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
return webrtc.NewAPI(webrtc.WithSettingEngine(s))
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue