github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/pkg/summary/summary.go (about)

     1  // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
     2  
     3  package summary
     4  
     5  import "time"
     6  
     7  // SetUnit set unit "backup/restore" for summary log.
     8  func SetUnit(unit string) {
     9  	collector.SetUnit(unit)
    10  }
    11  
    12  // CollectSuccessUnit collects success time costs.
    13  func CollectSuccessUnit(name string, unitCount int, arg interface{}) {
    14  	collector.CollectSuccessUnit(name, unitCount, arg)
    15  }
    16  
    17  // CollectFailureUnit collects fail reason.
    18  func CollectFailureUnit(name string, reason error) {
    19  	collector.CollectFailureUnit(name, reason)
    20  }
    21  
    22  // CollectDuration collects log time field.
    23  func CollectDuration(name string, t time.Duration) {
    24  	collector.CollectDuration(name, t)
    25  }
    26  
    27  // CollectInt collects log int field.
    28  func CollectInt(name string, t int) {
    29  	collector.CollectInt(name, t)
    30  }
    31  
    32  // CollectUint collects log uint64 field.
    33  func CollectUint(name string, t uint64) {
    34  	collector.CollectUInt(name, t)
    35  }
    36  
    37  // SetSuccessStatus sets final success status.
    38  func SetSuccessStatus(success bool) {
    39  	collector.SetSuccessStatus(success)
    40  }
    41  
    42  // Summary outputs summary log.
    43  func Summary(name string) {
    44  	collector.Summary(name)
    45  }