Skip to content

Commit

Permalink
Implement From<LoggerStoppedError> for Error`.
Browse files Browse the repository at this point in the history
  • Loading branch information
mleonhard committed Dec 13, 2023
1 parent 1f3dc9a commit 4eaed1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ Functions Expressions Impls Traits Methods Dependency
See [rust-webserver-comparison.md](https://github.com/mleonhard/servlin/blob/main/rust-webserver-comparison.md).

# Changelog
- v0.4.1 - Implement `From<LoggerStoppedError>`` for `Error`.
- v0.4.0
- Changed `Response::json` to return `Result<Response, Error>`.
- Changed `log_request_and_response` to return `Result`.
Expand Down Expand Up @@ -281,6 +282,8 @@ See [rust-webserver-comparison.md](https://github.com/mleonhard/servlin/blob/mai
- Fix limitations above
- Support [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD)
responses that have Content-Length set and no body.
- Add a server-wide limit on upload body size.
- Limit disk usage for caching uploads.
- Update `rust-webserver-comparison.md`
- Add missing data
- Add other servers from <https://www.arewewebyet.org/topics/frameworks/>
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
//! See [rust-webserver-comparison.md](https://github.com/mleonhard/servlin/blob/main/rust-webserver-comparison.md).
//!
//! # Changelog
//! - v0.4.1 - Implement `From<LoggerStoppedError>`` for `Error`.
//! - v0.4.0
//! - Changed `Response::json` to return `Result<Response, Error>`.
//! - Changed `log_request_and_response` to return `Result`.
Expand Down Expand Up @@ -133,6 +134,8 @@
//! - Fix limitations above
//! - Support [HEAD](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD)
//! responses that have Content-Length set and no body.
//! - Add a server-wide limit on upload body size.
//! - Limit disk usage for caching uploads.
//! - Update `rust-webserver-comparison.md`
//! - Add missing data
//! - Add other servers from <https://www.arewewebyet.org/topics/frameworks/>
Expand Down
7 changes: 6 additions & 1 deletion src/log/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::log::tag::Tag;
use crate::log::tag_list::TagList;
use crate::log::tag_value::TagValue;
use crate::log::Level;
use crate::Request;
use crate::{Error, Request};
use std::cell::RefCell;
use std::io::Write;
use std::ops::Deref;
Expand Down Expand Up @@ -206,6 +206,11 @@ pub fn add_thread_local_log_tags_from_request(req: &Request) {
#[allow(clippy::module_name_repetitions)]
#[derive(Debug)]
pub struct LoggerStoppedError {}
impl From<LoggerStoppedError> for Error {
fn from(_: LoggerStoppedError) -> Self {
Error::new().with_msg("LoggerStoppedError")
}
}

/// Make a new log event and sends it to the global logger.
///
Expand Down

0 comments on commit 4eaed1c

Please sign in to comment.