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

Optional Try Runtime Logging #7010

Closed
2 tasks done
aurexav opened this issue Dec 27, 2024 · 3 comments · Fixed by #7021
Closed
2 tasks done

Optional Try Runtime Logging #7010

aurexav opened this issue Dec 27, 2024 · 3 comments · Fixed by #7021
Labels
I5-enhancement An additional feature request.

Comments

@aurexav
Copy link
Contributor

aurexav commented Dec 27, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

No response

Request

Make such log

let mut sp = Spinner::with_timer(Spinners::Dots, "Scraping keys...".into());
optional.

The log looks good in terminal. But if we redirect it to a file. It becomes a disaster.

Solution

No response

Are you willing to help with this request?

Yes!, Maybe (please elaborate above)

@aurexav aurexav added the I5-enhancement An additional feature request. label Dec 27, 2024
@aurexav aurexav changed the title Optional Logging Optional Try Runtime Logging Dec 27, 2024
@bkchr
Copy link
Member

bkchr commented Dec 27, 2024

Sounds reasonable. We should probably detect if StdErr is a terminal and if not, not even initialize the spinner.

@AurevoirXavier can you do this? This should be useful here.

@aurexav
Copy link
Contributor Author

aurexav commented Dec 27, 2024

@AurevoirXavier can you do this? This should be useful here.

Great! I'll work on this.

@aurexav
Copy link
Contributor Author

aurexav commented Dec 27, 2024

https://www.reddit.com/r/programming/comments/41u5hw/what_is_the_exact_difference_between_a_terminal_a/

I'm wondering should we use is_tty or is_terminal?

https://github.com/softprops/atty

Okay, let's go is_terminal.

github-merge-queue bot pushed a commit that referenced this issue Jan 2, 2025
Changes:
- Automatically detect if current env is tty. If not disable the spinner
logging.
- Add `Result` type.
- Format log style.

Originally reported from:
-
https://github.com/hack-ink/polkadot-runtime-releaser/blob/4811d2b419649a73edd5bd1f748a858b846eb139/action/try-runtime/action.yml#L75-L91
-
hack-ink/polkadot-runtime-releaser-workshop#3 (comment)

Closes #7010.

---

Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y

---------

Signed-off-by: Xavier Lau <x@acg.box>
Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this issue Jan 4, 2025
Changes:
- Automatically detect if current env is tty. If not disable the spinner
logging.
- Add `Result` type.
- Format log style.

Originally reported from:
-
https://github.com/hack-ink/polkadot-runtime-releaser/blob/4811d2b419649a73edd5bd1f748a858b846eb139/action/try-runtime/action.yml#L75-L91
-
hack-ink/polkadot-runtime-releaser-workshop#3 (comment)

Closes paritytech#7010.

---

Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y

---------

Signed-off-by: Xavier Lau <x@acg.box>
Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants