1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

new accesslog middleware: require the writer inside its constructor so we can 'detect' if we must force-lock a writer

relative to: https://github.com/kataras/iris/issues/1601
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-09-07 18:04:35 +03:00
parent e96a009d3f
commit dac834cf11
4 changed files with 70 additions and 68 deletions

View File

@@ -15,11 +15,14 @@ func TestAccessLogPrint_Simple(t *testing.T) {
const goroutinesN = 42
w := new(bytes.Buffer)
ac := New()
ac.Writer = w
ac.LockWriter = true
ac := New(w)
ac.TimeFormat = "2006-01-02 15:04:05"
ac.Clock = TClock(time.Time{})
if !ac.LockWriter { // should be true because we register a *bytes.Buffer.
t.Fatalf("expected LockRriter to be true")
}
var (
expected string
wg = new(sync.WaitGroup)