mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-03 02:49:47 +00:00
fix:fix suppress noisy LiveKit/pion logs in non-debug mode
This commit is contained in:
@@ -178,6 +178,7 @@ func configureLogging(debug bool) {
|
||||
return
|
||||
}
|
||||
// Suppress noisy LiveKit/pion logs unless debug is enabled.
|
||||
_ = os.Setenv("PION_LOG_DISABLE", "all")
|
||||
lksdk.SetLogger(protoLogger.GetDiscardLogger())
|
||||
}
|
||||
|
||||
|
||||
@@ -183,17 +183,24 @@ func TestRunWithArgsSuccessfulSessionReturn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigureLogging(t *testing.T) {
|
||||
t.Setenv("PION_LOG_DISABLE", "")
|
||||
logger.SetVerbose(false)
|
||||
configureLogging(true)
|
||||
if !logger.IsVerbose() {
|
||||
t.Fatal("configureLogging(true) did not enable verbose logging")
|
||||
}
|
||||
if got := os.Getenv("PION_LOG_DISABLE"); got != "" {
|
||||
t.Fatalf("configureLogging(true) PION_LOG_DISABLE = %q, want empty", got)
|
||||
}
|
||||
|
||||
logger.SetVerbose(false)
|
||||
configureLogging(false)
|
||||
if logger.IsVerbose() {
|
||||
t.Fatal("configureLogging(false) enabled verbose logging")
|
||||
}
|
||||
if got := os.Getenv("PION_LOG_DISABLE"); got != "all" {
|
||||
t.Fatalf("configureLogging(false) PION_LOG_DISABLE = %q, want all", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveDataDir(t *testing.T) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
protoLogger "github.com/livekit/protocol/logger"
|
||||
lksdk "github.com/livekit/server-sdk-go/v2"
|
||||
"github.com/pion/webrtc/v4"
|
||||
)
|
||||
@@ -92,7 +93,13 @@ func (p *Peer) Connect(ctx context.Context) error {
|
||||
},
|
||||
}
|
||||
|
||||
room, err := lksdk.ConnectToRoomWithToken(wsURL, token, roomCB, lksdk.WithAutoSubscribe(true))
|
||||
room, err := lksdk.ConnectToRoomWithToken(
|
||||
wsURL,
|
||||
token,
|
||||
roomCB,
|
||||
lksdk.WithAutoSubscribe(true),
|
||||
lksdk.WithLogger(protoLogger.GetDiscardLogger()),
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect to room: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user