Open leonbreedt opened 4 years ago
Hi @leonbreedt, I've submitted a PR for another issue regarding the default logging / cookies in nested servers in https://github.com/http-rs/tide/pull/468, but like your proposition for with_logging()
and with_cookies()
better :)
IMHO it would be good to have them completely out of the server creation and use them as a builder Server::with_state(...).with_logger().with_cookies()
, or maybe even:
let app = tide::new()
.with_state(...)
.with_logging()
.with_cookies()
which would solve both of our problems :)
In my case, I use
Server::with_state()
, which means I get the standardLogMiddleware
.However, I have a custom logging middleware to add more context for request logging (method, path, etc as structured arguments instead of a formatted string).
So I get doubled up log entries.
It feels like deciding to have state (DB pool in my case) and getting default middleware should be separate decisions, like
with_logging()
,with_cookies()
?