Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests #11

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestLogger_Importantw_dev(t *testing.T) {
c.Info(ctx, "hello!", "foo", 1)
c.Important(ctx, "account created", "foo", 1)

assert.Equal(t, "<stripped>\tINFO\tzapctxd/logger_test.go:121\taccount created\t{\"foo\": 1}\n", w.String())
assert.Equal(t, "<stripped>\tINFO\tzapctxd/logger_test.go:120\taccount created\t{\"foo\": 1}\n", w.String())
}

func TestLogger_ColoredOutput_dev(t *testing.T) {
Expand All @@ -138,7 +138,7 @@ func TestLogger_ColoredOutput_dev(t *testing.T) {
c.Info(ctx, "hello!", "foo", 1)
c.Important(ctx, "account created", "foo", 1)

assert.Equal(t, "<stripped>\t\u001B[34mINFO\u001B[0m\tzapctxd/logger_test.go:140\taccount created\t{\"foo\": 1}\n", w.String())
assert.Equal(t, "<stripped>\t\u001B[34mINFO\u001B[0m\tzapctxd/logger_test.go:139\taccount created\t{\"foo\": 1}\n", w.String())
}

func TestNew_atomic_dev(t *testing.T) {
Expand All @@ -163,20 +163,20 @@ func TestNew_atomic_dev(t *testing.T) {
c.Important(ctx, "msg", "lvl", lvl, "important", true)
}

assert.Equal(t, `<stripped> ERROR zapctxd/logger_test.go:163 msg {"lvl": "error"}
<stripped> INFO zapctxd/logger_test.go:164 msg {"lvl": "error", "important": true}
<stripped> WARN zapctxd/logger_test.go:162 msg {"lvl": "warn"}
<stripped> ERROR zapctxd/logger_test.go:163 msg {"lvl": "warn"}
<stripped> INFO zapctxd/logger_test.go:164 msg {"lvl": "warn", "important": true}
<stripped> INFO zapctxd/logger_test.go:161 msg {"lvl": "info"}
<stripped> WARN zapctxd/logger_test.go:162 msg {"lvl": "info"}
<stripped> ERROR zapctxd/logger_test.go:163 msg {"lvl": "info"}
<stripped> INFO zapctxd/logger_test.go:164 msg {"lvl": "info", "important": true}
<stripped> DEBUG zapctxd/logger_test.go:160 msg {"lvl": "debug"}
<stripped> INFO zapctxd/logger_test.go:161 msg {"lvl": "debug"}
<stripped> WARN zapctxd/logger_test.go:162 msg {"lvl": "debug"}
<stripped> ERROR zapctxd/logger_test.go:163 msg {"lvl": "debug"}
<stripped> INFO zapctxd/logger_test.go:164 msg {"lvl": "debug", "important": true}
assert.Equal(t, `<stripped> ERROR zapctxd/logger_test.go:162 msg {"lvl": "error"}
<stripped> INFO zapctxd/logger_test.go:163 msg {"lvl": "error", "important": true}
<stripped> WARN zapctxd/logger_test.go:161 msg {"lvl": "warn"}
<stripped> ERROR zapctxd/logger_test.go:162 msg {"lvl": "warn"}
<stripped> INFO zapctxd/logger_test.go:163 msg {"lvl": "warn", "important": true}
<stripped> INFO zapctxd/logger_test.go:160 msg {"lvl": "info"}
<stripped> WARN zapctxd/logger_test.go:161 msg {"lvl": "info"}
<stripped> ERROR zapctxd/logger_test.go:162 msg {"lvl": "info"}
<stripped> INFO zapctxd/logger_test.go:163 msg {"lvl": "info", "important": true}
<stripped> DEBUG zapctxd/logger_test.go:159 msg {"lvl": "debug"}
<stripped> INFO zapctxd/logger_test.go:160 msg {"lvl": "debug"}
<stripped> WARN zapctxd/logger_test.go:161 msg {"lvl": "debug"}
<stripped> ERROR zapctxd/logger_test.go:162 msg {"lvl": "debug"}
<stripped> INFO zapctxd/logger_test.go:163 msg {"lvl": "debug", "important": true}
`, w.String(), w.String())
}

Expand Down Expand Up @@ -249,9 +249,9 @@ func TestLogger_SkipCaller(t *testing.T) {

do()

assert.Equal(t, `<stripped> INFO zapctxd/logger_test.go:246 hello {"k": "v"}
<stripped> INFO zapctxd/logger_test.go:251 world {"k": "v"}
<stripped> INFO zapctxd/logger_test.go:248 hello {"k": "v"}
assert.Equal(t, `<stripped> INFO zapctxd/logger_test.go:245 hello {"k": "v"}
<stripped> INFO zapctxd/logger_test.go:250 world {"k": "v"}
<stripped> INFO zapctxd/logger_test.go:247 hello {"k": "v"}
`, w.String())

assert.NotNil(t, zapctxd.New(zapctxd.Config{}).SkipCaller())
Expand Down
Loading