mirror of
https://github.com/Alexander-D-Karpov/concord.git
synced 2026-03-16 22:04:15 +03:00
46 lines
995 B
Go
46 lines
995 B
Go
package telemetry
|
|
|
|
import (
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type Logger struct {
|
|
base *zap.Logger
|
|
}
|
|
|
|
func NewLogger(base *zap.Logger) *Logger {
|
|
return &Logger{base: base}
|
|
}
|
|
|
|
func (l *Logger) LogPacketReceived(userID, roomID string, size int) {
|
|
l.base.Debug("packet received",
|
|
zap.String("user_id", userID),
|
|
zap.String("room_id", roomID),
|
|
zap.Int("size", size),
|
|
)
|
|
}
|
|
|
|
func (l *Logger) LogPacketSent(userID, roomID string, size int) {
|
|
l.base.Debug("packet sent",
|
|
zap.String("user_id", userID),
|
|
zap.String("room_id", roomID),
|
|
zap.Int("size", size),
|
|
)
|
|
}
|
|
|
|
func (l *Logger) LogSessionCreated(sessionID uint32, userID, roomID string) {
|
|
l.base.Info("session created",
|
|
zap.Uint32("session_id", sessionID),
|
|
zap.String("user_id", userID),
|
|
zap.String("room_id", roomID),
|
|
)
|
|
}
|
|
|
|
func (l *Logger) LogSessionEnded(sessionID uint32, userID, roomID string) {
|
|
l.base.Info("session ended",
|
|
zap.Uint32("session_id", sessionID),
|
|
zap.String("user_id", userID),
|
|
zap.String("room_id", roomID),
|
|
)
|
|
}
|