Skip to content

Commit fb8f6d4

Browse files
authored
Merge pull request #889 from joshtriplett/stop-exporting-logging
Stop re-exporting logging details from tide::log
2 parents eae7e56 + 0960344 commit fb8f6d4

27 files changed

+55
-86
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rustdoc-args = ["--cfg", "feature=\"docs\""]
2727
default = ["h1-server"]
2828
cookies = ["http-types/cookies"]
2929
h1-server = ["async-h1"]
30-
logger = ["femme"]
30+
logger = []
3131
docs = ["unstable"]
3232
sessions = ["async-session", "cookies"]
3333
sse = ["async-sse"]
@@ -39,7 +39,6 @@ async-session = { version = "3.0", optional = true }
3939
async-sse = { version = "5.1.0", optional = true }
4040
async-std = { version = "1.6.5", features = ["unstable"] }
4141
async-trait = "0.1.41"
42-
femme = { version = "2.1.1", optional = true }
4342
futures-util = "0.3.6"
4443
http-client = { version = "6.1.0", default-features = false }
4544
http-types = { version = "2.11.0", default-features = false, features = ["fs"] }
@@ -54,7 +53,9 @@ regex = "1.5.5"
5453
[dev-dependencies]
5554
async-std = { version = "1.6.5", features = ["unstable", "attributes"] }
5655
criterion = "0.3.3"
56+
femme = "2.1.1"
5757
juniper = "0.14.2"
58+
kv-log-macro = "1.0.7"
5859
lazy_static = "1.4.0"
5960
logtest = "2.0.0"
6061
portpicker = "0.1.0"

examples/catflap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#[async_std::main]
33
async fn main() -> Result<(), std::io::Error> {
44
use std::{env, net::TcpListener, os::unix::io::FromRawFd};
5-
tide::log::start();
5+
femme::start();
66
let mut app = tide::new();
77
app.with(tide::log::LogMiddleware::new());
88
app.at("/").get(|_| async { Ok(CHANGE_THIS_TEXT) });

examples/chunked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use tide::Body;
22

33
#[async_std::main]
44
async fn main() -> Result<(), std::io::Error> {
5-
tide::log::start();
5+
femme::start();
66
let mut app = tide::new();
77
app.with(tide::log::LogMiddleware::new());
88
app.at("/").get(|_| async {

examples/concurrent_listeners.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use tide::Request;
22

33
#[async_std::main]
44
async fn main() -> Result<(), std::io::Error> {
5-
tide::log::start();
5+
femme::start();
66
let mut app = tide::new();
77
app.with(tide::log::LogMiddleware::new());
88

examples/cookies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async fn remove_cookie(_req: Request<()>) -> tide::Result {
2121

2222
#[async_std::main]
2323
async fn main() -> Result<(), std::io::Error> {
24-
tide::log::start();
24+
femme::start();
2525
let mut app = tide::new();
2626
app.with(tide::log::LogMiddleware::new());
2727

examples/error_handling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use tide::{Body, Request, Response, Result, StatusCode};
55

66
#[async_std::main]
77
async fn main() -> Result<()> {
8-
tide::log::start();
8+
femme::start();
99
let mut app = tide::new();
1010
app.with(tide::log::LogMiddleware::new());
1111

examples/hello.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[async_std::main]
22
async fn main() -> Result<(), std::io::Error> {
3-
tide::log::start();
3+
femme::start();
44

55
let mut app = tide::new();
66
app.with(tide::log::LogMiddleware::new());

examples/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct Cat {
99

1010
#[async_std::main]
1111
async fn main() -> tide::Result<()> {
12-
tide::log::start();
12+
femme::start();
1313
let mut app = tide::new();
1414
app.with(tide::log::LogMiddleware::new());
1515

examples/middleware.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::pin::Pin;
33
use std::sync::atomic::{AtomicUsize, Ordering};
44
use std::sync::Arc;
55

6+
use kv_log_macro::trace;
67
use tide::http::mime;
78
use tide::utils::{After, Before};
89
use tide::{Middleware, Next, Request, Response, Result, StatusCode};
@@ -31,7 +32,7 @@ fn user_loader<'a>(
3132
) -> Pin<Box<dyn Future<Output = Result> + Send + 'a>> {
3233
Box::pin(async {
3334
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});
3536
request.set_ext(user);
3637
Ok(next.run(request).await)
3738
// this middleware only needs to run before the endpoint, so
@@ -64,7 +65,7 @@ struct RequestCount(usize);
6465
impl<State: Clone + Send + Sync + 'static> Middleware<State> for RequestCounterMiddleware {
6566
async fn handle(&self, mut req: Request<State>, next: Next<'_, State>) -> Result {
6667
let count = self.requests_counted.fetch_add(1, Ordering::Relaxed);
67-
tide::log::trace!("request counter", { count: count });
68+
trace!("request counter", { count: count });
6869
req.set_ext(RequestCount(count));
6970

7071
let mut res = next.run(req).await;
@@ -91,7 +92,7 @@ const INTERNAL_SERVER_ERROR_HTML_PAGE: &str = "<html><body>
9192

9293
#[async_std::main]
9394
async fn main() -> Result<()> {
94-
tide::log::start();
95+
femme::start();
9596
let mut app = tide::with_state(UserDatabase::default());
9697

9798
app.with(After(|response: Response| async move {

examples/nested.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[async_std::main]
22
async fn main() -> Result<(), std::io::Error> {
3-
tide::log::start();
3+
femme::start();
44
let mut app = tide::new();
55
app.with(tide::log::LogMiddleware::new());
66
app.at("/").get(|_| async { Ok("Root") });

0 commit comments

Comments
 (0)