From 2479e61db99f753104b4506d47733975c6fbcedd Mon Sep 17 00:00:00 2001 From: JessonChan Date: Tue, 12 Jan 2016 19:09:00 +0800 Subject: [PATCH] add asynchronous and call depth benchmark --- logs/file_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/logs/file_test.go b/logs/file_test.go index f7929942..d03d3ca5 100644 --- a/logs/file_test.go +++ b/logs/file_test.go @@ -141,3 +141,26 @@ func BenchmarkAsynchronousFile(b *testing.B) { } os.Remove("test4.log") } + +func BenchmarkCallDepthFile(b *testing.B) { + log := NewLogger(100000) + log.SetLogger("file", `{"filename":"test4.log"}`) + log.EnableFuncCallDepth(true) + log.SetLogFuncCallDepth(2) + for i := 0; i < b.N; i++ { + log.Debug("debug") + } + os.Remove("test4.log") +} + +func BenchmarkAsynchronousCallDepthFile(b *testing.B) { + log := NewLogger(100000) + log.SetLogger("file", `{"filename":"test4.log"}`) + log.EnableFuncCallDepth(true) + log.SetLogFuncCallDepth(2) + log.Async() + for i := 0; i < b.N; i++ { + log.Debug("debug") + } + os.Remove("test4.log") +}