package libp2pwebrtc
import (
"context"
"fmt"
"log/slog"
logging "github.com/libp2p/go-libp2p/gologshim"
pionLogging "github.com/pion/logging"
)
var log = logging .Logger ("webrtc-transport" )
var pionLog = logging .Logger ("webrtc-transport-pion" )
type pionLogger struct {
*slog .Logger
}
var pLog = pionLogger {pionLog }
var _ pionLogging .LeveledLogger = pLog
func (l pionLogger ) Debug (s string ) {
l .Logger .Debug (s )
}
func (l pionLogger ) Debugf (s string , args ...interface {}) {
if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
l .Logger .Debug (fmt .Sprintf (s , args ...))
}
}
func (l pionLogger ) Error (s string ) {
l .Logger .Debug (s )
}
func (l pionLogger ) Errorf (s string , args ...interface {}) {
if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
l .Logger .Debug (fmt .Sprintf (s , args ...))
}
}
func (l pionLogger ) Info (s string ) {
l .Logger .Debug (s )
}
func (l pionLogger ) Infof (s string , args ...interface {}) {
if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
l .Logger .Debug (fmt .Sprintf (s , args ...))
}
}
func (l pionLogger ) Warn (s string ) {
l .Logger .Debug (s )
}
func (l pionLogger ) Warnf (s string , args ...interface {}) {
if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
l .Logger .Debug (fmt .Sprintf (s , args ...))
}
}
func (l pionLogger ) Trace (s string ) {
l .Logger .Debug (s )
}
func (l pionLogger ) Tracef (s string , args ...interface {}) {
if l .Logger .Enabled (context .Background (), slog .LevelDebug ) {
l .Logger .Debug (fmt .Sprintf (s , args ...))
}
}
type loggerFactory struct {}
func (loggerFactory ) NewLogger (_ string ) pionLogging .LeveledLogger {
return pLog
}
var _ pionLogging .LoggerFactory = loggerFactory {}
var pionLoggerFactory = loggerFactory {}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .