| 148 | } |
| 149 | |
| 150 | func TestLoggerDebugf(t *testing.T) { |
| 151 | for _, tc := range formatTestCases { |
| 152 | tc := tc |
| 153 | tc.level = DebugLevel |
| 154 | message := fmt.Sprintf(tc.format, tc.args...) |
| 155 | tc.wantedPattern = fmt.Sprintf(`^\[DBG\] \w+\.go:\d+: %s\n$`, message) |
| 156 | t.Run(tc.description, func(t *testing.T) { |
| 157 | var buf bytes.Buffer |
| 158 | logger := NewLogger(newBase(&buf)) |
| 159 | logger.SetLevel(DebugLevel) |
| 160 | logger.Debugf(tc.format, tc.args...) |
| 161 | got := buf.String() |
| 162 | assert.Regexp(t, tc.wantedPattern, got) |
| 163 | }) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func TestLoggerInfof(t *testing.T) { |
| 168 | for _, tc := range formatTestCases { |