Skip to content

Commit

Permalink
Level-based logging for graphql schema tools
Browse files Browse the repository at this point in the history
Summary: Replacing `println!` with level-based logging. Main goal was to get timestamp-ed messages but it also keeps code clean from `if (verbose) { ... }` kind of blocks.

Reviewed By: gary-z

Differential Revision: D47189630

fbshipit-source-id: 18cad398ac6bd65acc2448b553f1a2b49152030a
  • Loading branch information
Arseniy Panfilov authored and facebook-github-bot committed Jul 3, 2023
1 parent 97206df commit 4d9f255
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions compiler/crates/schema-validate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ common = { path = "../common" }
fnv = "1.0"
intern = { path = "../intern" }
lazy_static = "1.4"
log = { version = "0.4.17", features = ["kv_unstable", "kv_unstable_std"] }
rayon = "1.2"
regex = "1.6.0"
schema = { path = "../schema" }
Expand Down
5 changes: 3 additions & 2 deletions compiler/crates/schema-validate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use intern::string_key::Intern;
use intern::string_key::StringKey;
use intern::Lookup;
use lazy_static::lazy_static;
use log::info;
use rayon::prelude::*;
use regex::Regex;
use schema::EnumID;
Expand Down Expand Up @@ -97,8 +98,8 @@ impl<'schema> ValidationContext<'schema> {
self.validate_root_types();
self.validate_directives();
self.validate_types();
println!("Validated Schema in {}ms", now.elapsed().as_millis());
println!(
info!("Validated Schema in {}ms", now.elapsed().as_millis());
info!(
"Found {} validation errors",
self.errors.lock().unwrap().len()
)
Expand Down

0 comments on commit 4d9f255

Please sign in to comment.