feat: add fields with logx methods, support using third party logging libs. (#1847)
* backup * simplify * chore: remove unused pool * chore: fix lint errors * chore: use strings.Builder instead of bytes.Buffer * test: add more tests * chore: fix reviewdog * test: fix data race * feat: make logger customizable * chore: fix reviewdog * test: fix fails * chore: fix set writer twice * chore: use context instead of golang.org context * chore: specify uint32 for level types
This commit is contained in:
@@ -120,7 +120,14 @@ func TestRotateLoggerWrite(t *testing.T) {
|
||||
os.Remove(filepath.Base(logger.getBackupFilename()) + ".gz")
|
||||
}()
|
||||
}
|
||||
// the following write calls cannot be changed to Write, because of DATA RACE.
|
||||
logger.write([]byte(`foo`))
|
||||
rule.rotatedTime = time.Now().Add(-time.Hour * 24).Format(dateFormat)
|
||||
logger.write([]byte(`bar`))
|
||||
logger.Close()
|
||||
logger.write([]byte(`baz`))
|
||||
}
|
||||
|
||||
func TestLogWriterClose(t *testing.T) {
|
||||
assert.Nil(t, newLogWriter(nil).Close())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user