1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

WriteCsvFile自定义分割符,增加map切片写入csv,增加追踪函数运行时间的函数 (#157)

* WriteCsvFile now support custom delimiter,Add write map slice to csv

* add trace func time
This commit is contained in:
colorcrow
2024-01-01 16:54:04 +08:00
committed by GitHub
parent 565f2893b9
commit 3482f80d1c
2 changed files with 70 additions and 2 deletions

View File

@@ -381,3 +381,12 @@ func TimestampNano(timezone ...string) int64 {
return t.UnixNano()
}
// TraceFuncTime: trace the func costed time,just call it at top of the func like `defer TraceFuncTime()()`
func TraceFuncTime() func() {
pre := time.Now()
return func() {
elapsed := time.Since(pre)
fmt.Println("Costs Time:\t", elapsed)
}
}