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

Ability to prefix output of Catch #1727

Open
ranty-fugue opened this issue Aug 15, 2019 · 0 comments
Open

Ability to prefix output of Catch #1727

ranty-fugue opened this issue Aug 15, 2019 · 0 comments

Comments

@ranty-fugue
Copy link

ranty-fugue commented Aug 15, 2019

Description
I'm working in a context in which multiple systems log during the process of running catch. As a result, I tend to see output like the following:

something can be done
      Given: A thing with some items
my system logs
system 1 logs
system 2 logs
more system 1 logs
etc.
       When: something is done to the thing
even
more
logging
       Then: it is done properly

These logs happen sometimes dozens or even hundreds of time between each step of catch, and this occurs for hundreds of tests.

What I would like is the ability to set a prefix of some sort before each line of the catch output so I can get a visual hint in the logging where the catch output is as opposed to other logs, as well as to be able to run a regex to search for or transform it.

As far as I can tell, there is no way to do this properly without modifying the source in every place text is sent to stdout.

Additional context

  • A good deal of the time, I'm working in Xcode, so trying alternate output forms is not really an option: I'm chained to stdout. And what's more, I want the interleaved logging, as it assists in triage.
  • My first thought was the obvious one, to strip out the additional logging besides catch, but even with a lot of time spent working through complex regular expressions, it's never quite right: I'm not in control of the other systems that log, nor their style of logging, so capturing the exact form is impossible.
  • I tried using Catch::cout trickily to insert a prefix before returning std::cout, but that didn't work properly, because catch calls Catch::cout() periodically to call rdbuf() on it, which causes duplicate prefixes.
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

No branches or pull requests

1 participant