mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? This changes all methods that fail tests on the test logger to **forcibly** fail it by calling `t.Fatalf`. It adds the stack trace to the failure message as we'd otherwise have no information on the _path_ to the failure, which is why we initially used `panic` ## Why? While testing a separate project I determined that panics from OSS' test logger (and the internal one it is based on!) were being caught by our application code, obscuring issues that should cause tests to fail. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [x] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks This may fail more tests than we currently do. This is a Good Thing.
30 lines
750 B
Go
30 lines
750 B
Go
// Code generated by "stringer -type Level -trimprefix Level -output testlogger.gen.go"; DO NOT EDIT.
|
|
|
|
package testlogger
|
|
|
|
import "strconv"
|
|
|
|
func _() {
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
var x [1]struct{}
|
|
_ = x[Debug-0]
|
|
_ = x[Info-1]
|
|
_ = x[Warn-2]
|
|
_ = x[Error-3]
|
|
_ = x[Fatal-4]
|
|
_ = x[DPanic-5]
|
|
_ = x[Panic-6]
|
|
}
|
|
|
|
const _Level_name = "DebugInfoWarnErrorFatalDPanicPanic"
|
|
|
|
var _Level_index = [...]uint8{0, 5, 9, 13, 18, 23, 29, 34}
|
|
|
|
func (i Level) String() string {
|
|
if i < 0 || i >= Level(len(_Level_index)-1) {
|
|
return "Level(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
}
|
|
return _Level_name[_Level_index[i]:_Level_index[i+1]]
|
|
}
|