/
summary.go
45 lines (35 loc) · 1.07 KB
/
summary.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
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package summary
import "time"
// SetUnit set unit "backup/restore" for summary log.
func SetUnit(unit string) {
collector.SetUnit(unit)
}
// CollectSuccessUnit collects success time costs.
func CollectSuccessUnit(name string, unitCount int, arg interface{}) {
collector.CollectSuccessUnit(name, unitCount, arg)
}
// CollectFailureUnit collects fail reason.
func CollectFailureUnit(name string, reason error) {
collector.CollectFailureUnit(name, reason)
}
// CollectDuration collects log time field.
func CollectDuration(name string, t time.Duration) {
collector.CollectDuration(name, t)
}
// CollectInt collects log int field.
func CollectInt(name string, t int) {
collector.CollectInt(name, t)
}
// CollectUint collects log uint64 field.
func CollectUint(name string, t uint64) {
collector.CollectUInt(name, t)
}
// SetSuccessStatus sets final success status.
func SetSuccessStatus(success bool) {
collector.SetSuccessStatus(success)
}
// Summary outputs summary log.
func Summary(name string) {
collector.Summary(name)
}