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

Improve console/logging support #1546

Closed
1 of 3 tasks
rfwatson opened this issue Sep 7, 2020 · 8 comments · Fixed by #2021
Closed
1 of 3 tasks

Improve console/logging support #1546

rfwatson opened this issue Sep 7, 2020 · 8 comments · Fixed by #2021
Labels
feature-request A feature request

Comments

@rfwatson
Copy link

rfwatson commented Sep 7, 2020

Describe the feature you'd like

Improved integration with console/logging in the browser, especially:

  • ability to console.log any JsValue*, without pre-encoding to a &str in Rust
  • support for variadic args when logging

*or the std_web equivalent, if possible

Is your feature request related to a problem? Please describe. (Optional)

Debugging large objects (e.g. arrays containing audio data) is painful from Rust right now

Describe alternatives you've considered (Optional)

N/A

Additional context (Optional)

N/A

Questionnaire

  • I'm interested in implementing this myself but don't know where to start
  • I would like to add this feature
  • I don't have time to add this right now, but maybe later
@rfwatson rfwatson added the feature-request A feature request label Sep 7, 2020
@jstarry
Copy link
Member

jstarry commented Sep 8, 2020

@rfwatson have you seen the following crates:
https://crates.io/crates/wasm-logger (web-sys)
https://crates.io/crates/web_logger (stdweb)

@siku2
Copy link
Member

siku2 commented Sep 8, 2020

@jstarry This issue is based on a discussion we had on the Discord server (here). The problem with these crates is that the formatting happens on Rust's end. This prevents browsers from displaying JavaScript objects with the same inspection tools as you would get when logging them through console.log.

@jstarry
Copy link
Member

jstarry commented Sep 8, 2020

Ah that makes sense, thanks

@siku2
Copy link
Member

siku2 commented Sep 15, 2020

Where should we go with this now that weblog is a thing?
Should we deprecate the ConsoleService and re-export the weblog macros instead?

Either way I think we should deprecate/remove the current ConsoleService now that there are plenty more powerful alternatives around.

@jstarry
Copy link
Member

jstarry commented Sep 16, 2020

Should we deprecate the ConsoleService and re-export the weblog macros instead?

I'd like to see all the services eventually move to external dependencies so I'm totally fine with this

@rfwatson
Copy link
Author

Happy to work on a patch to integrate the weblog crate if it's useful.

@siku2
Copy link
Member

siku2 commented Sep 16, 2020

I'd like to see all the services eventually move to external dependencies

@jstarry yeah, that's what I'm thinking as well. Glad we're on the same page there.


@rfwatson there are still a few features missing from weblog which are present in ConsoleService. Particularly the count*, group*, and time* function families and assert. Having these would make the transition a lot smoother.

There are also some other console features which ConsoleService doesn't implement either but they aren't holding this back.

@hamza1311
Copy link
Member

#1842 and rustwasm/gloo#142 resolved this for the most part. I think the only thing left is toreplace the console calls inside yew with gloo (from log)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants