Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/server/internal/webrtc/pionlog/factory.go
2022-09-13 20:35:53 +02:00

28 lines
483 B
Go

package pionlog
import (
"github.com/pion/logging"
"github.com/rs/zerolog"
)
func New(logger zerolog.Logger) Factory {
return Factory{
Logger: logger.With().Str("submodule", "pion").Logger(),
}
}
type Factory struct {
Logger zerolog.Logger
}
func (l Factory) NewLogger(subsystem string) logging.LeveledLogger {
if subsystem == "sctp" {
return nulllog{}
}
return logger{
subsystem: subsystem,
logger: l.Logger.With().Str("subsystem", subsystem).Logger(),
}
}