Skip to content

Conversation

@drewish
Copy link

@drewish drewish commented Mar 15, 2020

I'd like to offer up some docs changes from the perspective of an experienced programmer that is very new to rust. I'm trying to use tide for a simple project to webhooks and got tripped up by a few things:

  • I wanted to enable some basic logging and it seemed like an oversight that the crate's overview didn't specifically show how to use the middleware. I added a code sample to try to demonstrate that.
  • I didn't realize the RequestLogger needed additional crates to actually log output so I added a couple comments there.
  • I tried using the middleware example to write my own logger... and then realized that "simplified example" meant "won't compile". I found an example in the tests and realized it wasn't that much more complicated to show a working example.

//!
//! ```ignore
//! async fn log(req: Request, next: Next) -> Result<Response> {
//! println!("Incoming request from {} on url {}", req.peer_addr(), req.url());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

peer_addr() doesn't seem to exist any longer and url() is not uri().

@drewish drewish changed the title Use working logger middleware example Middleware and logging docs changes Mar 15, 2020
@drewish
Copy link
Author

drewish commented Mar 16, 2020

Looks like something timed out in that test. Not seeing a way to restart it so going to see if closing and reopening the PR will trigger it.

@drewish drewish closed this Mar 16, 2020
@drewish drewish reopened this Mar 16, 2020
@drewish drewish closed this Mar 21, 2020
@drewish drewish reopened this Mar 21, 2020
Seemed to be copy pasted from body_form.
@goto-bus-stop goto-bus-stop changed the base branch from master to main August 9, 2020 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant