package net import ( "net" "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs" "go.uber.org/zap" ) type LogEventHandler struct { logger *zap.Logger } func (l LogEventHandler) DialPerformed(sourceIP net.Addr, _, address string, err error) { sourceIPString := "undefined" if sourceIP != nil { sourceIPString = sourceIP.Network() + "://" + sourceIP.String() } if err == nil { l.logger.Debug(logs.MultinetDialSuccess, zap.String("source", sourceIPString), zap.String("destination", address)) } else { l.logger.Debug(logs.MultinetDialFail, zap.String("source", sourceIPString), zap.String("destination", address), zap.Error(err)) } } func NewLogEventHandler(logger *zap.Logger) LogEventHandler { return LogEventHandler{logger: logger} }