From c1e399ae1867a55b0138e482bd5774d10c79e1d0 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 16 Sep 2021 18:29:30 +0800 Subject: [PATCH] Add example of debug log support --- examples/tokio/Cargo.toml | 2 ++ examples/tokio/src/main.rs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/tokio/Cargo.toml b/examples/tokio/Cargo.toml index 173e9906f..b1124aad6 100644 --- a/examples/tokio/Cargo.toml +++ b/examples/tokio/Cargo.toml @@ -10,3 +10,5 @@ publish = false [dependencies] sea-orm = { path = "../../", features = [ "sqlx-all", "runtime-tokio-native-tls" ] } tokio = { version = "1", features = ["full"] } +env_logger = { version = "^0.9" } +log = { version = "^0.4" } diff --git a/examples/tokio/src/main.rs b/examples/tokio/src/main.rs index dd81b4ab6..14a76086c 100644 --- a/examples/tokio/src/main.rs +++ b/examples/tokio/src/main.rs @@ -3,7 +3,12 @@ use sea_orm::*; #[tokio::main] pub async fn main() { - let db = Database::connect("sql://sea:sea@localhost/bakery") + env_logger::builder() + .filter_level(log::LevelFilter::Debug) + .is_test(true) + .init(); + + let db = Database::connect("mysql://sea:sea@localhost/bakery") .await .unwrap();