smol icon indicating copy to clipboard operation
smol copied to clipboard

Logging

Open ghost opened this issue 5 years ago • 6 comments

We should have some traces in the reactor or executor

ghost avatar Jun 22 '20 16:06 ghost

It would be really cool if the executor timed futures and logged a warning when they take an unusually long time.

ghost avatar Jun 22 '20 22:06 ghost

I want to add some logging to both reactor and executor but need concrete suggestions:

  • What in particular would you like to see logged?
  • What logging format should be used? How do we display a text message and then some additional info?

ghost avatar Jul 14 '20 21:07 ghost

What logging format should be used?

Wouldn't logging output and formatting be handled by the application through something like tracing_subscriber or log? That would probably be preferred over having smol log directly. There are too many different format's and places you might want to log to ( syslog, stdout/stderror, etc. ).

How do we display a text message and then some additional info?

The tracing crate allows you to specify a message and extra fields, but again, I think the display should probably be left up to the user.


What in particular would you like to see logged?

I'm not completely sure, especially because I don't know what smol does under the hood that I might need to know about. :)

It would be great to have warnings for common mistakes or other things that might seem amiss if there are ways to misuse smol or other things that smol might be able to notice like detecting when to turn up the thread count or something ( I don't know just throwing it out there ).

If I were a smol developer I might want some trace logs that print out low-level events that could be useful for debugging.

zicklag avatar Jul 14 '20 23:07 zicklag

+1 for trace. Example usage in the h2 project: https://github.com/hyperium/h2/blob/d3b9f1e36aadc1a7a6804e2f8e86d3fe4a244b4f/src/proto/connection.rs.

awaited-hare avatar Jul 24 '20 05:07 awaited-hare

rustc is using tracing these days, and as a result, tracing has gone through many optimizations. It seems like a good default.

joshtriplett avatar Aug 25 '20 00:08 joshtriplett

I'd like to use tracing, but it's currently blocked until we bump our MSRV. See #244.

notgull avatar Apr 01 '23 21:04 notgull