File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,17 @@ impl Logger {
128
128
}
129
129
130
130
/// Set a range of status to include in the logging
131
- pub fn status_range < R : RangeBounds < StatusCode > > ( mut self , status : R ) -> Self {
131
+ ///
132
+ /// # Examples
133
+ /// ```
134
+ /// use actix_web::{middleware::Logger, App, http::StatusCode};
135
+ ///
136
+ /// // Log only the requests with status code higher or equal to BAD_REQUEST(400)
137
+ /// let app = App::new()
138
+ /// .wrap(Logger::default().statuses(StatusCode::BAD_REQUEST..));
139
+ ///
140
+ /// ```
141
+ pub fn statuses < R : RangeBounds < StatusCode > > ( mut self , status : R ) -> Self {
132
142
let inner = Rc :: get_mut ( & mut self . 0 ) . unwrap ( ) ;
133
143
inner. status_range = ( status. start_bound ( ) . cloned ( ) , status. end_bound ( ) . cloned ( ) ) ;
134
144
self
You can’t perform that action at this time.
0 commit comments