ReSpeak / tsclientlib

A TeamSpeak3 protocol implementation for usage in clients and bots
Apache License 2.0
121 stars 15 forks source link

Breaking Changes #25

Closed Flakebi closed 3 years ago

Flakebi commented 3 years ago

This issue is used to announce breaking changes when they are pushed.

cc @0xpr03

Flakebi commented 3 years ago

6e8e5b3b14aec1d6e422b6de65af1e96b235b582 Replace slog with tracing

0xpr03 commented 3 years ago

ah nice, then I can drop 5 crates :)

Jokler commented 3 years ago

Uhm, why was this change made if I may ask?

Flakebi commented 3 years ago

It looks like tracing is the way forward as it’s adopted by more crates and provides similar structured logging as slog. Incidentally, making the switch reduced the size of the code base noticably, which was surprising for me.

Jokler commented 3 years ago

It's mostly that I find passing around a logger much easier to think about than working with globals. I switched to slog because I have multiple connections to TeamSpeak open at the same time. Each connection has it's own slog logger with the name of the connection attached to make logs readable.

I have no idea how I would achieve the same with tracing currently. Do you have any advice?

0xpr03 commented 3 years ago

The global instance is much easier I think. Having to create a logger, passing it around and dealing with ownership for logging is pretty annoying in my opinion. (And also it's better to go with the community to reduce crate overhead and get better "support".)

Jokler commented 3 years ago

The thread locality makes it difficult for me to understand how to link spans to sections of code for me. It seems like each thread has one span at a time instead of each piece of code having one logger to me but I might be wrong.

Flakebi commented 3 years ago

I see what you mean, the same thing bugged me when doing the transition. The implicit logger works well for functional-style programming but not so much for long-living objects.

It’s still possible to explicitly pass around a logger. Span::current() gives the current logger, then use let _span = my_span.enter(); or log!(parent: &my_span, …) to log. I use that in the audio handling.

Jokler commented 3 years ago

That sounds nicer, I might give that a try, thanks!

Flakebi commented 3 years ago

self_cell was updated to 0.10 in 8436d5ff9ce78793519f5a9ec16ed9bef0ba94e5 due to soundness bugs (see #27 for more info).

0xpr03 commented 3 years ago

Huh, that's kind of stuff why I fear writing these low level things myself.