Skip to content

Commit

Permalink
chore: log [cli] with tracing-subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Dec 23, 2021
1 parent 6b72b7f commit c6e2abf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sea-orm-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ sea-schema = { version = "0.3.0", default-features = false, features = [
"writer",
] }
sqlx = { version = "^0.5", default-features = false, features = [ "mysql", "postgres" ] }
env_logger = { version = "^0.9" }
log = { version = "^0.4" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = { version = "0.1" }
url = "^2.2"

[dev-dependencies]
Expand Down
7 changes: 3 additions & 4 deletions sea-orm-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use clap::ArgMatches;
use dotenv::dotenv;
use log::LevelFilter;
use sea_orm_codegen::{EntityTransformer, OutputFile, WithSerde};
use std::{error::Error, fmt::Display, fs, io::Write, path::Path, process::Command, str::FromStr};
use url::Url;
Expand Down Expand Up @@ -33,9 +32,9 @@ async fn run_generate_command(matches: &ArgMatches<'_>) -> Result<(), Box<dyn Er
let expanded_format = args.is_present("EXPANDED_FORMAT");
let with_serde = args.value_of("WITH_SERDE").unwrap();
if args.is_present("VERBOSE") {
let _ = ::env_logger::builder()
.filter_level(LevelFilter::Debug)
.is_test(true)
let _ = tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.with_test_writer()
.try_init();
}

Expand Down

0 comments on commit c6e2abf

Please sign in to comment.