Skip to content

Commit

Permalink
add: naive implementation on logger
Browse files Browse the repository at this point in the history
This is a naive implementation on Request/Response logger using
a fork of `tiny-http` where the status_code and the content_length
is available.

Depends on:
- tiny-http/tiny-http#186
  • Loading branch information
EstebanBorai committed Oct 10, 2020
1 parent ddade36 commit 9360700
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 9 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Expand Up @@ -15,4 +15,5 @@ categories = ["web-programming", "web-programming::http-server"]
ascii = "0.8"
clap = "2.33.3"
mime_guess = "2.0"
tiny_http = "0.6"
# tiny_http = "0.6"
tiny_http = { path = "../tiny-http-tiny-http" }
1 change: 1 addition & 0 deletions src/server/http.rs
Expand Up @@ -43,6 +43,7 @@ impl HttpServer {

for request in self.server.incoming_requests() {
let (req, res) = main_handler(request, &self.file_explorer);
println!("{}\t{}\t{}\t{}", req.method(), req.url(), res.get_status_code().0, res.get_data_length().unwrap_or(0));
req.respond(res).unwrap();
}
}
Expand Down

0 comments on commit 9360700

Please sign in to comment.