Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable log prefix #472

Open
finestructure opened this issue Jun 12, 2024 · 2 comments · May be fixed by #476
Open

Configurable log prefix #472

finestructure opened this issue Jun 12, 2024 · 2 comments · May be fixed by #476
Assignees
Labels
enhancement New feature or request

Comments

@finestructure
Copy link
Contributor

finestructure commented Jun 12, 2024

Description

We are running test with lots of log output that are hard to run locally end-to-end, so we often have to rely on CI to get the results.

Getting these results is difficult because of how noisy the logs are. It'd be very helpful if we could set a custom prefix that is prepended to all testing output lines. That way we can filter/search the log chaos on a known string in the CI viewer and zero in on just the test failure output.

Would be great if this was a global config or even a per-test trait.

Expected behavior

Actual behavior

Steps to reproduce

No response

swift-testing version/commit hash

No response

Swift & OS version (output of swift --version && uname -a)

No response

@finestructure finestructure added the enhancement New feature or request label Jun 12, 2024
@grynspan
Copy link
Contributor

I can do this pretty easily.

@grynspan
Copy link
Contributor

--experimental-console-output-prefix ++ getenv("SWT_EXPERIMENTAL_CONSOLE_OUTPUT_PREFIX").

grynspan added a commit that referenced this issue Jun 12, 2024
…put.

This PR adds the ability to specify a prefix that should be applied to all
output from the command line when using `swift test`. For example, if you
specify the prefix "`[WHEE]`", then you'll get output like:

> [WHEE] ◇ Test run started.
> [WHEE] ↳ Testing Library Version: ff2775952f346dd94757adffa7f7ba57bcc4b2d1 (modified)
> [WHEE] ◇ Suite "My suite" started.
(etc.)

Since the `--experimental-console-output-prefix` argument is not recognized by
Swift Package Manager, you can also specify the prefix using an environment
variable, `"SWT_EXPERIMENTAL_CONSOLE_OUTPUT_PREFIX"`.

Resolves #472.
Resolves rdar://129677014.
@grynspan grynspan self-assigned this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants