mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
mononoke/lfs_server: log requests
Summary: This adds a logging middleware that logs requests to stdlog (and therefore to slog through slog-stdlog). It's convenient for tests, and it's also a pretty standard thing for HTTP servers. Reviewed By: StanislavGlebik Differential Revision: D17263040 fbshipit-source-id: 992c5e46ba9ae5b829001a26536b827130aa813c
This commit is contained in:
parent
e8d730579c
commit
71a63a31b3
@ -16,8 +16,8 @@ use futures_util::{compat::Future01CompatExt, try_future::try_join_all};
|
||||
use gotham::{
|
||||
bind_server,
|
||||
handler::HandlerFuture,
|
||||
middleware::state::StateMiddleware,
|
||||
pipeline::{single::single_pipeline, single_middleware},
|
||||
middleware::{logger::RequestLogger, state::StateMiddleware},
|
||||
pipeline::{new_pipeline, single::single_pipeline},
|
||||
router::{
|
||||
builder::{build_router, DefineSingleRoute, DrawRoutes},
|
||||
Router,
|
||||
@ -84,8 +84,10 @@ fn health_handler(state: State) -> (State, &'static str) {
|
||||
}
|
||||
|
||||
fn router(lfs_ctx: LfsServerContext) -> Router {
|
||||
let middleware = StateMiddleware::new(lfs_ctx);
|
||||
let pipeline = single_middleware(middleware);
|
||||
let pipeline = new_pipeline()
|
||||
.add(StateMiddleware::new(lfs_ctx))
|
||||
.add(RequestLogger::new(::log::Level::Info))
|
||||
.build();
|
||||
let (chain, pipelines) = single_pipeline(pipeline);
|
||||
|
||||
build_router(chain, pipelines, |route| {
|
||||
|
Loading…
Reference in New Issue
Block a user