-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
zaptest: Add testing.TB compatible logger #518
Commits on Oct 31, 2017
-
zaptest: Add testing.TB compatible logger
This adds `zaptest.NewTestLogger(testing.TB) *zap.Logger` and a level-override variant of it. This will enable us to use non-nop loggers from tests without spamming the output. These loggers will not print any output unless the test failed or `go test -v` was used.
Configuration menu - View commit details
-
Copy full SHA for 4f818a2 - Browse repository at this point
Copy the full SHA 4f818a2View commit details -
Configuration menu - View commit details
-
Copy full SHA for be2b5ea - Browse repository at this point
Copy the full SHA be2b5eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for a73cb3f - Browse repository at this point
Copy the full SHA a73cb3fView commit details -
Configuration menu - View commit details
-
Copy full SHA for e78537e - Browse repository at this point
Copy the full SHA e78537eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c4600e - Browse repository at this point
Copy the full SHA 9c4600eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 316a110 - Browse repository at this point
Copy the full SHA 316a110View commit details
Commits on Nov 1, 2017
-
Rely on subset of testing.TB interface
This declares a TestingT interface which is a subset of the functionality provided by testing.TB, and changes zaptest to rely on that. This also means that zaptest no longer imports the "testing" package.
Configuration menu - View commit details
-
Copy full SHA for ca6ac7d - Browse repository at this point
Copy the full SHA ca6ac7dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 660acc6 - Browse repository at this point
Copy the full SHA 660acc6View commit details
Commits on Feb 21, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 4de70e3 - Browse repository at this point
Copy the full SHA 4de70e3View commit details
Commits on Mar 26, 2018
-
Use bytes.TrimRight instead of manual trimming
Also, no explicit string conversion
Configuration menu - View commit details
-
Copy full SHA for 959d416 - Browse repository at this point
Copy the full SHA 959d416View commit details -
test: All levels for happy case
This tests all log levels for the happy case.
Configuration menu - View commit details
-
Copy full SHA for 063f7a1 - Browse repository at this point
Copy the full SHA 063f7a1View commit details -
testLogSpy: Logf should log the message
testLogSpy was logging the `args`, not the actual string.
Configuration menu - View commit details
-
Copy full SHA for 8dd84b6 - Browse repository at this point
Copy the full SHA 8dd84b6View commit details -
testingWriter: Return original length
testingWriter should return the length of the original slice, not the trimmed slice.
Configuration menu - View commit details
-
Copy full SHA for 3ebc5fc - Browse repository at this point
Copy the full SHA 3ebc5fcView commit details
Commits on Apr 2, 2018
-
zaptest: Expand TestingT interface
This expands the TestingT interface to a much larger subset of `testing.TB`. The following were left out: - `Error` and `Log` were left out in favor of `Errorf` and `Logf` - `Fatal*` methods were left out in favor of `Errorf` followed by `FailNow` - `Skip*` methods were left out because our test logger shouldn't be skipping tests - `Helper` was left out because not all supported verisons of Go have that
Configuration menu - View commit details
-
Copy full SHA for cdd3f0b - Browse repository at this point
Copy the full SHA cdd3f0bView commit details -
zaptest/NewLogger: fail test on internal errors
Zap's errorOutput is used exclusively to log internal errors. If this ever gets used in a test, something catastrophic happened and we should fail the test. This changes the logger returned by zaptest.NewLogger to implement this behavior by passing a `WriteSyncer` to `zap.ErrorOutput` that marks the test as failed upon being used. To test this, we set up a test logger and replace its core with one that will always fail to write.
Configuration menu - View commit details
-
Copy full SHA for 2b3338c - Browse repository at this point
Copy the full SHA 2b3338cView commit details -
zaptest: testLogSpy doesn't have to be thread-safe
This simplifies the implementation of testLogSpy by removing all thread-safety from it. It's only used from these specific tests and never concurrently.
Configuration menu - View commit details
-
Copy full SHA for d7b6a16 - Browse repository at this point
Copy the full SHA d7b6a16View commit details
Commits on Apr 12, 2018
-
zaptest/NewLogger: Clarify default log level
This documents that loggers built with zaptest.NewLogger default to debug level logging.
Configuration menu - View commit details
-
Copy full SHA for d0af2be - Browse repository at this point
Copy the full SHA d0af2beView commit details