-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstats.go
59 lines (53 loc) · 898 Bytes
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"github.com/Masterminds/log-go"
)
type statistics struct {
inDummy int
inMail int
inRemFoo int
inYamn int
outDummy int
outMail int
outYamn int
outLoop int
outRandhop int
outPlain int
}
func (s *statistics) reset() {
s.inDummy = 0
s.inMail = 0
s.inYamn = 0
s.inRemFoo = 0
s.outDummy = 0
s.outMail = 0
s.outYamn = 0
s.outLoop = 0
s.outRandhop = 0
s.outPlain = 0
log.Info("Daily stats reset")
}
func (s *statistics) report() {
log.Infof(
"MailIn=%d, RemFoo=%d, YamnIn=%d, DummyIn=%d",
s.inMail,
s.inRemFoo,
s.inYamn,
s.inDummy,
)
line1 := fmt.Sprintf(
"MailOut=%d, YamnOut=%d, YamnLoop=%d, Randhop=%d, ",
s.outMail,
s.outYamn,
s.outLoop,
s.outRandhop,
)
line2 := fmt.Sprintf(
"FinalOut=%d, DummyOut=%d",
s.outPlain,
s.outDummy,
)
log.Infof(line1 + line2)
}
var stats = new(statistics)