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

Add a log adapter for zap.Logger #855

Merged
merged 1 commit into from
Apr 10, 2019
Merged

Add a log adapter for zap.Logger #855

merged 1 commit into from
Apr 10, 2019

Conversation

MaruHyl
Copy link
Contributor

@MaruHyl MaruHyl commented Apr 4, 2019

For #854

log/zap/zap_sugar_logger.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger.go Show resolved Hide resolved
@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.

log/zap/zap_sugar_logger_test.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger_test.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger_test.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger_test.go Outdated Show resolved Hide resolved
log/zap/zap_sugar_logger.go Show resolved Hide resolved
@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.

log/zap/zap_sugar_logger_test.go Outdated Show resolved Hide resolved
@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