tower-rs / tower-hyper

A hyper based tower transport layer.
MIT License
20 stars 11 forks source link

Usage of log considered harmful #45

Open mzabaluev opened 5 years ago

mzabaluev commented 5 years ago

tower-hyper uses macros from the log crate in asynchronous code internally. This is inflexible and problematic for a library crate: the logger instance of log is set globally in the application, whose developers might not be aware of logging going on in the library, while many popular logger implementations are blocking.

If logging must be done, it would be much better for task-bound structures such as Connect to incorporate an optional, application-settable structural logging context in the style of slog. The API users would then be aware of the logging, be able to add contextual information per instance, and be able to supply a non-blocking frontend such as slog-async.

mzabaluev commented 5 years ago

As #52 exposes the connection error through the Connection future, is the debug! statement really needed?

davidbarsky commented 5 years ago

@mzabaluev I think we'll end up switching to tracing instead for logging purposes.