SetUpTestLogging will set the given log level and log keys, and revert the changes at the end of the current test. This function will panic if called multiple times in the same test.
(tb testing.TB, logLevel LogLevel, logKeys ...LogKey)
| 587 | // |
| 588 | // This function will panic if called multiple times in the same test. |
| 589 | func SetUpTestLogging(tb testing.TB, logLevel LogLevel, logKeys ...LogKey) { |
| 590 | caller := GetCallersName(1, false) |
| 591 | InfofCtx(context.Background(), KeyAll, "%s: Setup logging: level: %v - keys: %v", caller, logLevel, logKeys) |
| 592 | cleanup := setTestLogging(logLevel, caller, logKeys...) |
| 593 | tb.Cleanup(cleanup) |
| 594 | } |
| 595 | |
| 596 | // ResetGlobalTestLogging will ensure that the loggers are replaced at the end of the the test. |
| 597 | func ResetGlobalTestLogging(t *testing.T) { |