Skip to content

Commit

Permalink
Add example for using timer to measure its own performance
Browse files Browse the repository at this point in the history
  • Loading branch information
E.Azer Koçulu committed Oct 14, 2017
1 parent eafa0c9 commit d7d53b7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/timer-performance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"github.com/azer/logger"
)

func main() {

var perf = logger.New("performance")
var test = logger.New("test")

timer := perf.Timer()
for i := 0; i < 999999; i++ {
t := test.Timer()
t.End("foobar", logger.Attrs{
"foo": 123,
"bar": true,
})
}
timer.End("End")
}

0 comments on commit d7d53b7

Please sign in to comment.