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

Print log output during synthesis #2269

Open
2 tasks
very-doge-wow opened this issue Nov 25, 2024 · 6 comments
Open
2 tasks

Print log output during synthesis #2269

very-doge-wow opened this issue Nov 25, 2024 · 6 comments
Labels
@component/cdk8s-cli Issue related to cdk8s-cli effort/small 1 day tops feature-request New/Enhanced functionality wanted priority/p2 Dependent on community feedback. PR's are welcome :)

Comments

@very-doge-wow
Copy link

Description of the feature or enhancement:

It currently doesn't seem possible to receive any logoutput in stdout while synthesizing the app.

Use Case:

I would like to be able to print different log outputs, so I can tell which branches of my code were executed.
We offer a CDK construct library as well which performs different tasks and generates values for the users.
It would be useful to be able to print information about the actions it has performed to the user, as the construct library
abstracts this away from the view of the user.

Proposed Solution:

If the --output flag is not set to print the synthesized output to stdout, provide the messages from console.log, console.warn, etc. through the stdout stream.

Other:

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@very-doge-wow very-doge-wow added feature-request New/Enhanced functionality wanted needs-triage Priority and effort undetermined yet labels Nov 25, 2024
@very-doge-wow very-doge-wow changed the title How to print log output during synthesis Print log output during synthesis Nov 25, 2024
@iliapolo iliapolo added @component/cdk8s-cli Issue related to cdk8s-cli effort/small 1 day tops priority/p2 Dependent on community feedback. PR's are welcome :) and removed needs-triage Priority and effort undetermined yet labels Dec 9, 2024
@iliapolo
Copy link
Member

iliapolo commented Dec 9, 2024

Indeed we do not currently print stdout to the console. But if its for debugging purposes, you could, in the meantime, use console.error (we do print stderr)

@very-doge-wow
Copy link
Author

Interesting. That would be one workaround, however I think it would confuse the users of our CDK construct if the messages appear in the stderr stream.

@pecigonzalo
Copy link

I think the problem is that printing to stdout could interfere with synthesis to stdout.

@very-doge-wow
Copy link
Author

very-doge-wow commented Dec 16, 2024

@pecigonzalo The synthesized output is only printed to stdout only if one explicitly sets the --output flag - in that case cdk8s could simply refrain from printing the log output. If it is not set however, I don't see a problem in printing the log to stdout.

@pecigonzalo
Copy link

@very-doge-wow what I mean is that the reason for printing to stderr instead of stdout is because its common for tools that can be piped together | to not print errors to stdout to avoid parsing problem when non-breaking errors arise. Keep in mind also that as a construct creator, you might not know how the construct is used.

This does not mean I don't understand the use-case, but Im explaining why it they might have chosen to not print stdout and instead use stderr.

@very-doge-wow
Copy link
Author

Maybe an additional flag could be provided to change the behavior - by default it would stay as it is now and only if the flag is activated, logoutput is printed? This way no existing integrations could break anywhere.
Something like --log or similar comes to mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@component/cdk8s-cli Issue related to cdk8s-cli effort/small 1 day tops feature-request New/Enhanced functionality wanted priority/p2 Dependent on community feedback. PR's are welcome :)
Projects
None yet
Development

No branches or pull requests

3 participants