Log average transfer rate

Adds the average transfer rate for the summary interval to the summary log lines
This commit is contained in:
Waldemar Zimpel 2024-10-23 02:51:26 +02:00
parent f4305180b9
commit 93f5d1ef7f

View file

@ -86,8 +86,10 @@ type EventOnProxyStats struct {
}
func (e EventOnProxyStats) String() string {
statString := fmt.Sprintf("In the last %v, there were %v completed connections. Traffic Relayed ↓ %v %v, ↑ %v %v.",
e.SummaryInterval.String(), e.ConnectionCount, e.InboundBytes, e.InboundUnit, e.OutboundBytes, e.OutboundUnit)
statString := fmt.Sprintf("In the last %v, there were %v completed connections. Traffic Relayed ↓ %v %v (%.2f %v%s), ↑ %v %v (%.2f %v%s).",
e.SummaryInterval.String(), e.ConnectionCount,
e.InboundBytes, e.InboundUnit, float64(e.InboundBytes)/e.SummaryInterval.Seconds(), e.InboundUnit, "/s",
e.OutboundBytes, e.OutboundUnit, float64(e.OutboundBytes)/e.SummaryInterval.Seconds(), e.OutboundUnit, "/s")
return statString
}