Skip to content

Conversation

3lpsy
Copy link
Contributor

@3lpsy 3lpsy commented Mar 29, 2025

Short Description:
This PR adds an optional "tracing" feature that will emit log messages to tracing. It does not affect current logging. To keep things simple, by enabling the feature, you're opting into emitting to tracing. This was to avoid adding state to the Tauri app on behalf of the plugin that would hold some sort of "is_using_tracing" value.

Problem it's addressing
To currently leverage tracing without this PR, applications must call skip_logger() and setup of the tracing-log logger themselves. This is overall fine. However, I was encountering issues with the tracing-log crate on iOS so wanted to a way to avoid the bridge. Additionally, since I only use tracing myself within my code, I only had the adapter to support this plugin and therefore this feature removes that requirement.

So overall, this PR would support:

  1. Allowing both the emission of logs and events. For example if users had different systems in place.
  2. Only emit traces via skip_logger() which would nop on the logger invocation and emit the trace.

Implementation is fairly basic in order to avoid unnecessary complexity. Please let me know if you have any feedback.

@3lpsy 3lpsy requested a review from a team as a code owner March 29, 2025 00:16
Copy link
Contributor

github-actions bot commented Mar 29, 2025

Package Changes Through 4a434d8

There are 12 changes which include autostart with minor, autostart-js with minor, http with patch, http-js with patch, deep-link with patch, deep-link-js with patch, log with minor, log-js with minor, fs with patch, fs-js with patch, updater with minor, updater-js with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.23 2.0.24
api-example-js 2.0.19 2.0.20
deep-link-example-js 2.2.0 2.2.1
autostart 2.2.0 2.3.0
autostart-js 2.2.0 2.3.0
deep-link 2.2.0 2.2.1
deep-link-js 2.2.0 2.2.1
fs 2.2.0 2.2.1
fs-js 2.2.0 2.2.1
dialog 2.2.0 2.2.1
dialog-js 2.2.0 2.2.1
http 2.4.2 2.4.3
http-js 2.4.2 2.4.3
log 2.3.1 2.4.0
log-js 2.3.1 2.4.0
persisted-scope 2.2.0 2.2.1
single-instance 2.2.2 2.2.3
updater 2.6.1 2.7.0
updater-js 2.6.1 2.7.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@Legend-Master Legend-Master merged commit 60fc35d into tauri-apps:v2 Apr 7, 2025
17 checks passed
@Legend-Master
Copy link
Contributor

I'm not the most familiar with tracing but it looks good to me in general, and since it doesn't affect existing code anyways, this is a good start, I'll merge it

Nice work, thanks!

gezihuzi pushed a commit to Hypobenthos/plugins-workspace that referenced this pull request Jun 22, 2025
* Let logging be skippable so user can handle logger()

* Add changes file

* changes meta info

* Update documentation

* Support emitting to tracing behind feature flag

* typo

* rename key_values => kv

* changes file

* Remove rebase skip-logger

* fix format
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 this pull request may close these issues.

2 participants