-
Raymond Cheung authored
This PR enhances **`test_log_capture`**, ensuring logs are **captured for assertions** and **printed to the console** during test execution. ## **Motivation** - Partially addresses #6119 and #6125, to improves developer **tracing and debugging** in XCM-related tests. - Builds on #7594, improving **log visibility** while maintaining test **log capture capabilities**. - While writing tests for #7234, I noticed this function was missing. This PR adds it to streamline log handling in unit tests. ## **Changes** - Ensures logs up to `TRACE` level are **captured** (for assertions) and **printed** (for visibility). - Refines documentation to clearly specify **when to use** each function. - **Removes ANSI escape codes** from captured logs to ensure clean, readable assertions. ## **When to Use?** | Usage | Captures Logs? | Prints Logs? | Example | |----------------------------------------------|-----------------|--------------|-----------------------------------------------| | `init_log_capture(LevelFilter::INFO, false)` |
Yes | No | Capture logs for assertions without printing. | | `init_log_capture(LevelFilter::TRACE, true)` | Yes | Yes | Capture logs and print them in test output. | | `sp_tracing::init_for_tests()` | No | Yes | Print logs to the console without capturing. | --------- Co-authored-by:cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Unverifiedce5f89c6
Code owners
Assign users and groups as approvers for specific file changes. Learn more.