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

tfswitch -U logs instead of returning version #505

Closed
brainsiq opened this issue Sep 18, 2024 · 6 comments · Fixed by #506
Closed

tfswitch -U logs instead of returning version #505

brainsiq opened this issue Sep 18, 2024 · 6 comments · Fixed by #506

Comments

@brainsiq
Copy link

brainsiq commented Sep 18, 2024

There appears to have been a change in the behaviour of tfswitch -U. It now returns a result via logs, which I understand from other issues appears to be a fairly recent change.

This means if you set the log level to error then you get no output at all.

❯ tfswitch -U --log-level=ERROR

❯ tfswitch -U --log-level=INFO
14:42:24.303 INFO 1.9.6

I was using -U to bootstrap new projects with the latest as required_version, which has stopped working, and needs to be updated to instead parse the output. This isn't a big problem but wanted to check if it is intended behaviour?

This also applies to other flags like -S and -P but isn't consistent with -v which returns raw output without logs.

@MatthewJohn
Copy link
Collaborator

MatthewJohn commented Sep 18, 2024 via email

@brainsiq
Copy link
Author

I tested that and it's definitely stdout.

tfswitch -U > program.stdout 2> program.stderr

The output is in the stdout file

@yermulnik
Copy link
Collaborator

Yep, agree too. Need to reconfigure logging to send to stderr and output to stdout only what's requested for --show-* flags.
I wish we've got more contributions as we seem to be stagnating on development again 😢

MatthewJohn added a commit that referenced this issue Sep 18, 2024
Create custom log handlers, which use stderr, based on the slog ConsoleHandler

Issue #505

Signed-off-by: Matthew John <matthew@dockstudios.co.uk>
MatthewJohn added a commit that referenced this issue Sep 18, 2024
…ght to stdout rather than using logging methods

This avoids stylising output, as is done with logging.
Avoids sending output to same destination as logs, which is now stderr

Issue #505

Signed-off-by: Matthew John <matthew@dockstudios.co.uk>
@MatthewJohn
Copy link
Collaborator

MatthewJohn commented Sep 18, 2024

@yermulnik @brainsiq I've had a quick go at this in #506 - let me know what you think :)

MatthewJohn added a commit that referenced this issue Sep 18, 2024
…ght to stdout rather than using logging methods

This avoids stylising output, as is done with logging.
Avoids sending output to same destination as logs, which is now stderr

Issue #505

Signed-off-by: Matthew John <matthew@dockstudios.co.uk>
@yermulnik yermulnik linked a pull request Sep 18, 2024 that will close this issue
@brainsiq
Copy link
Author

brainsiq commented Oct 2, 2024

Sorry for the lack of feedback, but I d/l the latest version of tswitch and the functionality now looks good to me. Not familiar with golang but was able to understand the code change too 👍

@yermulnik
Copy link
Collaborator

@brainsiq Thank you for the feedback 👍🏻

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

Successfully merging a pull request may close this issue.

3 participants