We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8419ac1 commit 2392c53Copy full SHA for 2392c53
actix-web/src/middleware/logger.rs
@@ -128,7 +128,17 @@ impl Logger {
128
}
129
130
/// Set a range of status to include in the logging
131
- pub fn status_range<R: RangeBounds<StatusCode>>(mut self, status: R) -> Self {
+ ///
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 {
142
let inner = Rc::get_mut(&mut self.0).unwrap();
143
inner.status_range = (status.start_bound().cloned(), status.end_bound().cloned());
144
self
0 commit comments