Skip to content

Comments

Add a log adapter for zap.Logger#855

Merged
ChrisHines merged 1 commit intogo-kit:masterfrom
MaruHyl:log-zap
Apr 10, 2019
Merged

Add a log adapter for zap.Logger#855
ChrisHines merged 1 commit intogo-kit:masterfrom
MaruHyl:log-zap

Conversation

@MaruHyl
Copy link
Contributor

@MaruHyl MaruHyl commented Apr 4, 2019

For #854

@MaruHyl
Copy link
Contributor Author

MaruHyl commented Apr 5, 2019

@peterbourgon done.

Copy link
Member

@ChrisHines ChrisHines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some test cases that probe the edge cases of the varargs kv passed to Log. Otherwise I made a few comments about readability.

@MaruHyl
Copy link
Contributor Author

MaruHyl commented Apr 8, 2019

@ChrisHines Hi, I rewrote the test according to your suggestion.

Copy link
Member

@ChrisHines ChrisHines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more improvement then we're good.

@MaruHyl
Copy link
Contributor Author

MaruHyl commented Apr 9, 2019

@ChrisHines ok, use subtests now, test output

=== RUN   TestZapSugarLogger
--- PASS: TestZapSugarLogger (0.00s)
=== RUN   TestZapSugarLogger/debug
    --- PASS: TestZapSugarLogger/debug (0.00s)
        zap_sugar_logger_test.go:83: {"L":"DEBUG","T":"2019-04-09T12:26:09.090+0800","M":"","key1":"value1"}
=== RUN   TestZapSugarLogger/info
    --- PASS: TestZapSugarLogger/info (0.00s)
        zap_sugar_logger_test.go:83: {"L":"INFO","T":"2019-04-09T12:26:09.091+0800","M":"","key2":"value2"}
=== RUN   TestZapSugarLogger/warn
    --- PASS: TestZapSugarLogger/warn (0.00s)
        zap_sugar_logger_test.go:83: {"L":"WARN","T":"2019-04-09T12:26:09.091+0800","M":"","key3":"value3"}
=== RUN   TestZapSugarLogger/error
    --- PASS: TestZapSugarLogger/error (0.00s)
        zap_sugar_logger_test.go:83: {"L":"ERROR","T":"2019-04-09T12:26:09.091+0800","M":"","key4":"value4"}
=== RUN   TestZapSugarLogger/dpanic
    --- PASS: TestZapSugarLogger/dpanic (0.00s)
        zap_sugar_logger_test.go:83: {"L":"DPANIC","T":"2019-04-09T12:26:09.091+0800","M":"","key5":"value5"}
=== RUN   TestZapSugarLogger/panic
    --- PASS: TestZapSugarLogger/panic (0.00s)
        zap_sugar_logger_test.go:83: {"L":"PANIC","T":"2019-04-09T12:26:09.091+0800","M":"","key6":"value6"}
PASS

@ChrisHines
Copy link
Member

@MaruHyl Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants