examples/custom-logger/README.md
custom-logger is an example demonstrating how to override the default logging behavior of the Pion WebRTC stack.
By default, Pion logs everything to stdout.
This example shows how to inject a custom LoggerFactory to handle logs from every subsystem (ICE, DTLS, SCTP, DataChannel...).
logging.LeveledLogger.offerer and answerer) locally.ICE candidate gatheringDTLS handshakeSCTP and DataChannel setupcustomLogger Debug:.Ideal for:
go install github.com/pion/webrtc/v4/examples/custom-logger@latest
Make sure $(go env GOPATH)/bin is in your PATH.
You can add it to your PATH like this (zsh):
echo 'export PATH="$PATH:$(go env GOPATH)/bin"' >> ~/.zshrc
source ~/.zshrc
custom-logger or go run main.go
Creating logger for ice
Creating logger for dtls
Peer Connection State has changed: connected (answerer)
Peer Connection State has changed: connected (offerer)
customLogger Debug: Adding a new peer-reflexive candidate: 10.8.21.1:51196
You should see messages from our customLogger, as two PeerConnections start a session