-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
131 changed files
with
12,990 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,115 @@ | ||
package zlog | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func Test_log(t *testing.T) { | ||
func Test_log(t *testing.T) { | ||
|
||
i := 1 | ||
|
||
SetEnv(LOG_DEBUG) | ||
for{ | ||
F().Infof("%s","测试下好不好" + strconv.Itoa(i)) | ||
SetEnv(LOG_PRO) | ||
for { | ||
F().Infof("%s", "测试下好不好"+strconv.Itoa(i)) | ||
//F("xuzan2").Error(errors.New("错误")) | ||
if i >= 1000{ | ||
if i >= 1000 { | ||
break | ||
} | ||
t.Log(i,F() == nil ,F()) | ||
time.Sleep(1*time.Second) | ||
t.Log(i, F() == nil, F()) | ||
time.Sleep(1 * time.Second) | ||
|
||
i++ | ||
//glg.Infof("in main args:%v", os.Args) | ||
//glg.Errorf("eerror %v", "error") | ||
} | ||
time.Sleep(5*time.Second) | ||
time.Sleep(5 * time.Second) | ||
} | ||
|
||
|
||
func Test_logv2(t *testing.T) { | ||
func Test_logv2(t *testing.T) { | ||
|
||
i := 1 | ||
|
||
SetEnv(LOG_DEBUG) | ||
for{ | ||
Infof("%s","测试下好不好" + strconv.Itoa(i)) | ||
for { | ||
Infof("%s", "测试下好不好"+strconv.Itoa(i)) | ||
//F("xuzan2").Error(errors.New("错误")) | ||
if i >= 1000{ | ||
if i >= 1000 { | ||
break | ||
} | ||
time.Sleep(1*time.Second) | ||
time.Sleep(1 * time.Second) | ||
i++ | ||
//glg.Infof("in main args:%v", os.Args) | ||
//glg.Errorf("eerror %v", "error") | ||
} | ||
time.Sleep(5*time.Second) | ||
time.Sleep(5 * time.Second) | ||
} | ||
|
||
// 4.3更新 | ||
func Test_logv3(t *testing.T) { | ||
|
||
i := 1 | ||
//SetEnv(LOG_PRO) | ||
SetLog(ENV_DEBUG, WithMaxAge(10*24), WithRotationTime(24)) | ||
for { | ||
F().Infof("%s", "测试下好不好"+strconv.Itoa(i)) | ||
F().Debugf("%s", "debug测试下好不好"+strconv.Itoa(i)) | ||
F().Errorf("%s", "error测试下好不好"+strconv.Itoa(i)) | ||
if i >= 1000 { | ||
break | ||
} | ||
t.Log(i, F() == nil, F()) | ||
time.Sleep(1 * time.Second) | ||
|
||
i++ | ||
|
||
} | ||
time.Sleep(5 * time.Second) | ||
} | ||
|
||
func Test_logv4(t *testing.T) { | ||
|
||
i := 1 | ||
//SetEnv(ENV_DEBUG) | ||
SetLog(ENV_DEBUG) | ||
//SetLog(ENV_DEBUG, WithMaxAge(10*24), WithRotationTime(24)) | ||
|
||
for is := 0; is <= 10; is++ { | ||
go func(is int) { | ||
for { | ||
|
||
F(fmt.Sprintf("test_%d", is)).Errorf("%s", fmt.Sprintf("v4_%d_error测试"+strconv.Itoa(i), is)) | ||
|
||
//t.Log(i, F() == nil, F()) | ||
time.Sleep(3 * time.Second) | ||
|
||
} | ||
}(is) | ||
} | ||
|
||
select {} | ||
} | ||
|
||
func Test_logv5(t *testing.T) { | ||
|
||
i := 1 | ||
//SetEnv(ENV_DEBUG) | ||
SetLog(ENV_DEBUG) | ||
//SetLog(ENV_DEBUG, WithMaxAge(10*24), WithRotationTime(24)) | ||
|
||
for is := 0; is <= 10; is++ { | ||
go func(is int) { | ||
for { | ||
|
||
F("test").Errorf("%s", fmt.Sprintf("v5_%d_error测试"+strconv.Itoa(i), is)) | ||
|
||
time.Sleep(10 * time.Second) | ||
|
||
} | ||
}(is) | ||
} | ||
|
||
select {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.