Logging
This commit is contained in:
parent
7f38621c3c
commit
9d5ce08ff8
@ -31,7 +31,7 @@ chrono = { version = "^0", optional = true }
|
|||||||
futures = { version = "^0.3" }
|
futures = { version = "^0.3" }
|
||||||
futures-util = { version = "^0.3" }
|
futures-util = { version = "^0.3" }
|
||||||
rust_decimal = { version = "^1", optional = true }
|
rust_decimal = { version = "^1", optional = true }
|
||||||
sea-orm-macros = { version = "^0.1.1", optional = true }
|
sea-orm-macros = { version = "^0.1.1", path = "sea-orm-macros", optional = true }
|
||||||
sea-query = { version = "^0.16", features = ["thread-safe"] }
|
sea-query = { version = "^0.16", features = ["thread-safe"] }
|
||||||
sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
|
sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] }
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
serde = { version = "^1.0", features = ["derive"] }
|
||||||
@ -40,6 +40,7 @@ sqlx-core = { version = "^0.5", optional = true }
|
|||||||
sqlx-macros = { version = "^0.5", optional = true }
|
sqlx-macros = { version = "^0.5", optional = true }
|
||||||
serde_json = { version = "^1", optional = true }
|
serde_json = { version = "^1", optional = true }
|
||||||
uuid = { version = "0.8", features = ["serde", "v4"], optional = true }
|
uuid = { version = "0.8", features = ["serde", "v4"], optional = true }
|
||||||
|
log = { version = "^0.4", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
smol = { version = "^1.2" }
|
smol = { version = "^1.2" }
|
||||||
@ -49,11 +50,12 @@ tokio = { version = "^1.6", features = ["full"] }
|
|||||||
actix-rt = { version = "2.2.0" }
|
actix-rt = { version = "2.2.0" }
|
||||||
maplit = { version = "^1" }
|
maplit = { version = "^1" }
|
||||||
rust_decimal_macros = { version = "^1" }
|
rust_decimal_macros = { version = "^1" }
|
||||||
|
env_logger = { version = "^0.9" }
|
||||||
sea-orm = { path = ".", features = ["debug-print"] }
|
sea-orm = { path = ".", features = ["debug-print"] }
|
||||||
pretty_assertions = { version = "^0.7" }
|
pretty_assertions = { version = "^0.7" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debug-print = []
|
debug-print = ["log"]
|
||||||
default = [
|
default = [
|
||||||
"macros",
|
"macros",
|
||||||
"mock",
|
"mock",
|
||||||
|
@ -99,6 +99,10 @@ pub fn test(_: TokenStream, input: TokenStream) -> TokenStream {
|
|||||||
#[test]
|
#[test]
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
fn #name() #ret {
|
fn #name() #ret {
|
||||||
|
let _ = ::env_logger::builder()
|
||||||
|
.filter_level(::log::LevelFilter::Debug)
|
||||||
|
.is_test(true)
|
||||||
|
.try_init();
|
||||||
crate::block_on!(async { #body })
|
crate::block_on!(async { #body })
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[cfg(feature = "debug-print")]
|
#[cfg(feature = "debug-print")]
|
||||||
macro_rules! debug_print {
|
macro_rules! debug_print {
|
||||||
($( $args:expr ),*) => { println!( $( $args ),* ); }
|
($( $args:expr ),*) => { log::debug!( $( $args ),* ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user