plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

refactor(updater): replace `log` crate with `tracing` for improved logging

Open thep0y opened this issue 10 months ago • 6 comments

thep0y avatar Apr 03 '25 01:04 thep0y

Package Changes Through d407712d59f5decf35f9785147e8907de5365159

There are 3 changes which include log with minor, log-js with minor, updater with patch

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.24 2.0.25
api-example-js 2.0.20 2.0.21
log 2.3.1 2.4.0
log-js 2.3.1 2.4.0
updater 2.7.0 2.7.1

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


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

github-actions[bot] avatar Apr 03 '25 02:04 github-actions[bot]

Is there any reason in particular to use tracing instead of log? Like we didn't use span or anything, wouldn't log be enough?

Legend-Master avatar Apr 07 '25 01:04 Legend-Master

If logs are recorded using the log crate, when a user's project uses tracing to record logs, it becomes difficult to log messages in the updater due to the difference in logging frameworks. This can be resolved using tracing_log, but it is not the optimal solution. Currently, all implemented plugins mix the use of log and tracing. In this scenario, using tracing as the default logger is a better choice. Of course, the best implementation would be to make tracing an optional or default feature for each plugin, rather than specifying it as a dependency.

thep0y avatar Apr 07 '25 04:04 thep0y

I see, I feel like we probably want to rethink about where to use log where to use trace, I didn't even realize that we're mixing the two all over the place 😅

cc @lucasfernog since you added the logs

Legend-Master avatar Apr 07 '25 11:04 Legend-Master

why is tracing_log not optimal? there will always be a bunch of crates using either log or tracing (or in our case, incorrectly mixing both). I see log as the common factor between them, and we use tracing mostly when it's marked as an optional feature (which I agree is a bit weird).

lucasfernog avatar Apr 07 '25 13:04 lucasfernog

All plugins should have tracing as an optional dependency, allowing users to conveniently choose either log or tracing as the logger.

thep0y avatar Apr 08 '25 00:04 thep0y