-
Notifications
You must be signed in to change notification settings - Fork 8
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
log plugin compat #158
base: main
Are you sure you want to change the base?
log plugin compat #158
Conversation
The `tracing-log` interop layer reports log metadata in a different format, this PR adds handling for these special metadata keys to improve the quality of reported log metadata
Since devtools is incompatible with the log plugin anyway (it serves the same purpose too but better) it would be handy for it to fully replace the log plugin during development. This PR adds the last missing piece of interop with the log plugin by intercepting the JS log messages and emitting them to the same log stream as all other messages.
✅ Deploy Preview for cn-devtools-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for cn-devtools-website canceled.
|
tauri::plugin::Builder::new("probe") | ||
// we pretend to be the log plugin so we can intercept the commands | ||
// this plugin is incompatible with the log plugin anyway | ||
tauri::plugin::Builder::new("log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this.. I feel if someone is using devtools, they shouldn't need the log plugin. We should document that instead (e.g. use the log plugin on production, devtools on development).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is the idea, but as stated in the issue #150 devtools misses out the one feature that makes tauri-plugin-log
great: the ability to emit logs from both Rust and JS to the same place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about making the log plugin not crash on init? so you can keep using its APIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that could work actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gonna be difficult though, bc we have to init the log plugin in the setup
callback not the builder function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does it matter? as long as we tell people to enable devtools first and both register at the same place..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean like this?
tauri::Builder::default()
.plugin(devtools::init())
.plugin(tauri_plugin_log::init())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah (plus where we actually register the log plugin)
This adds compatibility with the JS commands from the
tauri-plugin-log
by intercepting calls to thelog
command and emitting them to the unified data stream.This also adds handling for properly displaying the source code location of JS messages if available.
builds on #159
resolves #150 resolves DT-69