feat: implement console plain output for debug logs (#1456)
* feat: implement console plain output for debug logs * chore: rename console encoding to plain * chore: refactor names
This commit is contained in:
@@ -37,6 +37,19 @@ func TestWithDurationInfo(t *testing.T) {
|
||||
assert.True(t, strings.Contains(builder.String(), "duration"), builder.String())
|
||||
}
|
||||
|
||||
func TestWithDurationInfoConsole(t *testing.T) {
|
||||
old := encoding
|
||||
encoding = plainEncodingType
|
||||
defer func() {
|
||||
encoding = old
|
||||
}()
|
||||
|
||||
var builder strings.Builder
|
||||
log.SetOutput(&builder)
|
||||
WithDuration(time.Second).Info("foo")
|
||||
assert.True(t, strings.Contains(builder.String(), "ms"), builder.String())
|
||||
}
|
||||
|
||||
func TestWithDurationInfof(t *testing.T) {
|
||||
var builder strings.Builder
|
||||
log.SetOutput(&builder)
|
||||
|
||||
Reference in New Issue
Block a user