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/logger.go

67 lines
1.3 KiB
Go
Raw Normal View History

2022-09-13 08:24:34 +12:00
package pionlog
import (
"fmt"
"strings"
"github.com/rs/zerolog"
)
type logger struct {
logger zerolog.Logger
subsystem string
}
func (l logger) Trace(msg string) {
l.logger.Trace().Msg(strings.TrimSpace(msg))
}
func (l logger) Tracef(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
l.logger.Trace().Msg(strings.TrimSpace(msg))
}
func (l logger) Debug(msg string) {
l.logger.Debug().Msg(strings.TrimSpace(msg))
}
func (l logger) Debugf(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
l.logger.Debug().Msg(strings.TrimSpace(msg))
}
func (l logger) Info(msg string) {
if strings.Contains(msg, "duplicated packet") {
return
}
l.logger.Info().Msg(strings.TrimSpace(msg))
}
func (l logger) Infof(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
if strings.Contains(msg, "duplicated packet") {
return
}
l.logger.Info().Msg(strings.TrimSpace(msg))
}
func (l logger) Warn(msg string) {
l.logger.Warn().Msg(strings.TrimSpace(msg))
}
func (l logger) Warnf(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
l.logger.Warn().Msg(strings.TrimSpace(msg))
}
func (l logger) Error(msg string) {
l.logger.Error().Msg(strings.TrimSpace(msg))
}
func (l logger) Errorf(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
l.logger.Error().Msg(strings.TrimSpace(msg))
}