refactor(updater): replace `log` crate with `tracing` for improved logging
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
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?
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.
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
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).
All plugins should have tracing as an optional dependency, allowing users to conveniently choose either log or tracing as the logger.