Skip to content

Add ScopedRecordLogs for capturing and recording test logs.#4212

Draft
copybara-service[bot] wants to merge 1 commit intomainfrom
test_911553182
Draft

Add ScopedRecordLogs for capturing and recording test logs.#4212
copybara-service[bot] wants to merge 1 commit intomainfrom
test_911553182

Conversation

@copybara-service
Copy link
Copy Markdown

Add ScopedRecordLogs for capturing and recording test logs.

This change introduces LogCollectorSink, an absl::LogSink implementation that collects log messages. It also adds ScopedRecordLogs, a test utility that uses LogCollectorSink to capture all logs within its scope and records them as a test property using testing::Test::RecordProperty upon destruction. This is useful for debugging test failures by having the relevant logs attached to the test results.

This change introduces `LogCollectorSink`, an `absl::LogSink` implementation that collects log messages. It also adds `ScopedRecordLogs`, a test utility that uses `LogCollectorSink` to capture all logs within its scope and records them as a test property using `testing::Test::RecordProperty` upon destruction. This is useful for debugging test failures by having the relevant logs attached to the test results.

PiperOrigin-RevId: 911553182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant