Closed brainsiq closed 1 month ago
Hmm, I agree.
I think that if the desired output of an action is purely the output itself, it almost definitely shouldn’t be logged and should just be printed. I wonder whether the logging goes to stdout or stderr! 🤔
Matt
Sent from my iPhone
On 18 Sep 2024, at 15:06, Chris Impey @.***> wrote:
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 This also applies to other flags like -S and -P. Is this intended behaviour?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
I tested that and it's definitely stdout.
tfswitch -U > program.stdout 2> program.stderr
The output is in the stdout file
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 😢
@yermulnik @brainsiq I've had a quick go at this in https://github.com/warrensbox/terraform-switcher/pull/506 - let me know what you think :)
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 👍
@brainsiq Thank you for the feedback 👍🏻
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.
I was using
-U
to bootstrap new projects with the latest asrequired_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.