Skip to content

Commit

Permalink
switch log crate to tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
dzvon committed Aug 30, 2021
1 parent d15f646 commit ba0947d
Show file tree
Hide file tree
Showing 48 changed files with 276 additions and 238 deletions.
35 changes: 12 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/flycheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ doctest = false

[dependencies]
crossbeam-channel = "0.5.0"
log = "0.4.8"
tracing = "0.1"
cargo_metadata = "0.14"
serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0.48"
Expand Down
6 changes: 3 additions & 3 deletions crates/flycheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl FlycheckActor {
self.cancel_check_process();

let mut command = self.check_command();
log::info!("restart flycheck {:?}", command);
tracing::info!("restart flycheck {:?}", command);
command.stdout(Stdio::piped()).stderr(Stdio::null()).stdin(Stdio::null());
if let Ok(child) = command.spawn().map(JodChild) {
self.cargo_handle = Some(CargoHandle::spawn(child));
Expand All @@ -176,7 +176,7 @@ impl FlycheckActor {
let cargo_handle = self.cargo_handle.take().unwrap();
let res = cargo_handle.join();
if res.is_err() {
log::error!(
tracing::error!(
"Flycheck failed to run the following command: {:?}",
self.check_command()
)
Expand Down Expand Up @@ -319,7 +319,7 @@ impl CargoActor {
let message = match message {
Ok(message) => message,
Err(err) => {
log::error!("Invalid json from cargo check, ignoring ({})", err);
tracing::error!("Invalid json from cargo check, ignoring ({})", err);
continue;
}
};
Expand Down
1 change: 0 additions & 1 deletion crates/hir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2018"
doctest = false

[dependencies]
log = "0.4.8"
rustc-hash = "1.1.0"
either = "1.5.3"
arrayvec = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_def/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ doctest = false
[dependencies]
cov-mark = "2.0.0-pre.1"
dashmap = { version = "4.0.2", features = ["raw-api"] }
log = "0.4.8"
tracing = "0.1"
once_cell = "1.3.1"
rustc-hash = "1.1.0"
either = "1.5.3"
Expand Down
4 changes: 2 additions & 2 deletions crates/hir_def/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Expander {
None => {
// Only `None` if the macro expansion produced no usable AST.
if err.is_none() {
log::warn!("no error despite `parse_or_expand` failing");
tracing::warn!("no error despite `parse_or_expand` failing");
}

return Ok(ExpandResult::only_err(err.unwrap_or_else(|| {
Expand All @@ -152,7 +152,7 @@ impl Expander {
}
};

log::debug!("macro expansion {:#?}", node.syntax());
tracing::debug!("macro expansion {:#?}", node.syntax());

self.recursion_limit += 1;
let mark = Mark {
Expand Down
26 changes: 13 additions & 13 deletions crates/hir_def/src/nameres/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub(super) fn collect_defs(
if block.is_none() {
// populate external prelude
for dep in &crate_graph[def_map.krate].dependencies {
log::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id);
tracing::debug!("crate dep {:?} -> {:?}", dep.name, dep.crate_id);
let dep_def_map = db.crate_def_map(dep.crate_id);
def_map
.extern_prelude
Expand Down Expand Up @@ -358,7 +358,7 @@ impl DefCollector<'_> {

i += 1;
if FIXED_POINT_LIMIT.check(i).is_err() {
log::error!("name resolution is stuck");
tracing::error!("name resolution is stuck");
break 'outer;
}
}
Expand Down Expand Up @@ -510,7 +510,7 @@ impl DefCollector<'_> {
return;
}
_ => {
log::debug!(
tracing::debug!(
"could not resolve prelude path `{}` to module (resolved to {:?})",
path,
per_ns.types
Expand Down Expand Up @@ -654,7 +654,7 @@ impl DefCollector<'_> {
current_module_id: LocalModuleId,
extern_crate: &item_tree::ExternCrate,
) {
log::debug!(
tracing::debug!(
"importing macros from extern crate: {:?} ({:?})",
extern_crate,
self.def_map.edition,
Expand Down Expand Up @@ -718,7 +718,7 @@ impl DefCollector<'_> {
}

fn resolve_import(&self, module_id: LocalModuleId, import: &Import) -> PartialResolvedImport {
log::debug!("resolving import: {:?} ({:?})", import, self.def_map.edition);
tracing::debug!("resolving import: {:?} ({:?})", import, self.def_map.edition);
if import.is_extern_crate {
let res = self.def_map.resolve_name_in_extern_prelude(
self.db,
Expand Down Expand Up @@ -794,7 +794,7 @@ impl DefCollector<'_> {
def.macros = None;
}

log::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);
tracing::debug!("resolved import {:?} ({:?}) to {:?}", name, import, def);

// extern crates in the crate root are special-cased to insert entries into the extern prelude: rust-lang/rust#54658
if import.is_extern_crate && module_id == self.def_map.root {
Expand All @@ -806,7 +806,7 @@ impl DefCollector<'_> {
self.update(module_id, &[(name, def)], vis, ImportType::Named);
}
ImportKind::Glob => {
log::debug!("glob import: {:?}", import);
tracing::debug!("glob import: {:?}", import);
match def.take_types() {
Some(ModuleDefId::ModuleId(m)) => {
if import.is_prelude {
Expand Down Expand Up @@ -895,10 +895,10 @@ impl DefCollector<'_> {
self.update(module_id, &resolutions, vis, ImportType::Glob);
}
Some(d) => {
log::debug!("glob import {:?} from non-module/enum {:?}", import, d);
tracing::debug!("glob import {:?} from non-module/enum {:?}", import, d);
}
None => {
log::debug!("glob import {:?} didn't resolve as type", import);
tracing::debug!("glob import {:?} didn't resolve as type", import);
}
}
}
Expand Down Expand Up @@ -947,7 +947,7 @@ impl DefCollector<'_> {
let tr = match res.take_types() {
Some(ModuleDefId::TraitId(tr)) => tr,
Some(other) => {
log::debug!("non-trait `_` import of {:?}", other);
tracing::debug!("non-trait `_` import of {:?}", other);
continue;
}
None => continue,
Expand Down Expand Up @@ -1167,7 +1167,7 @@ impl DefCollector<'_> {
) {
if EXPANSION_DEPTH_LIMIT.check(depth).is_err() {
cov_mark::hit!(macro_expansion_overflow);
log::warn!("macro expansion is too deep");
tracing::warn!("macro expansion is too deep");
return;
}
let file_id = macro_call_id.as_file();
Expand Down Expand Up @@ -1694,7 +1694,7 @@ impl ModCollector<'_, '_> {
} else if self.is_builtin_or_registered_attr(&attr.path) {
continue;
} else {
log::debug!("non-builtin attribute {}", attr.path);
tracing::debug!("non-builtin attribute {}", attr.path);

let ast_id = AstIdWithPath::new(
self.file_id(),
Expand Down Expand Up @@ -1768,7 +1768,7 @@ impl ModCollector<'_, '_> {
}
None => {
// FIXME: diagnose
log::debug!("malformed derive: {:?}", attr);
tracing::debug!("malformed derive: {:?}", attr);
}
}
}
Expand Down
Loading

0 comments on commit ba0947d

Please sign in to comment.