Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Having two SpawnGeneric, each with different verbosity configuration #80

Open
oshoval opened this issue Jun 19, 2022 · 0 comments
Open

Comments

@oshoval
Copy link

oshoval commented Jun 19, 2022

Hi
We are using goexpect at https://github.com/kubevirt/kubevirt [1]
With the following settings to SpawnGeneric:

opts = append(opts, expect.Verbose(true))
opts = append(opts, expect.VerboseWriter(GinkgoWriter))

[1] https://github.com/kubevirt/kubevirt/blob/75674879e91dfc24a340cae54c92ea7509e42cb4/tests/console/console.go#L209

On one hand it is perfect for us that only upon error or verbose mode, we see all the logged info.
The problem is that if there is an error, we have a custom error reporter, which also uses SpawnGeneric
in order to trigger some more commands that collect data.
Those commands would print as well all the collected info to the console, which cause it to be too loaded with info
which is not needed (it is saved to files as well where it belongs).

Is there a way to have two SpawnGeneric, where one prints to GinkgoWriter, while the other prints to /dev/null
or doesn't print at all ?

Tried few configurations, but no luck yet (changes might be required in the NewExpecter as well i believe)
For example tried to have a different buffer and control it (I believe I didn't do it right if it suppose to work)

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant