@@ -3,6 +3,7 @@ use std::pin::Pin;
3
3
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
4
4
use std:: sync:: Arc ;
5
5
6
+ use kv_log_macro:: trace;
6
7
use tide:: http:: mime;
7
8
use tide:: utils:: { After , Before } ;
8
9
use tide:: { Middleware , Next , Request , Response , Result , StatusCode } ;
@@ -31,7 +32,7 @@ fn user_loader<'a>(
31
32
) -> Pin < Box < dyn Future < Output = Result > + Send + ' a > > {
32
33
Box :: pin ( async {
33
34
if let Some ( user) = request. state ( ) . find_user ( ) . await {
34
- tide :: log :: trace!( "user loaded" , { user: user. name} ) ;
35
+ trace ! ( "user loaded" , { user: user. name} ) ;
35
36
request. set_ext ( user) ;
36
37
Ok ( next. run ( request) . await )
37
38
// this middleware only needs to run before the endpoint, so
@@ -64,7 +65,7 @@ struct RequestCount(usize);
64
65
impl < State : Clone + Send + Sync + ' static > Middleware < State > for RequestCounterMiddleware {
65
66
async fn handle ( & self , mut req : Request < State > , next : Next < ' _ , State > ) -> Result {
66
67
let count = self . requests_counted . fetch_add ( 1 , Ordering :: Relaxed ) ;
67
- tide :: log :: trace!( "request counter" , { count: count } ) ;
68
+ trace ! ( "request counter" , { count: count } ) ;
68
69
req. set_ext ( RequestCount ( count) ) ;
69
70
70
71
let mut res = next. run ( req) . await ;
@@ -91,7 +92,7 @@ const INTERNAL_SERVER_ERROR_HTML_PAGE: &str = "<html><body>
91
92
92
93
#[ async_std:: main]
93
94
async fn main ( ) -> Result < ( ) > {
94
- tide :: log :: start ( ) ;
95
+ femme :: start ( ) ;
95
96
let mut app = tide:: with_state ( UserDatabase :: default ( ) ) ;
96
97
97
98
app. with ( After ( |response : Response | async move {
0 commit comments